unable to get file using classLoader.getResource(fileName).getFile()
<p>I made a maven web-app project in eclipse it was working fine on the machine on which I made this. but when importing this project to other machine in eclipse it gives me this exception while getting the file:</p>

<blockquote>
  <p>exception:D:\Eclipse%20Workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\example\WEB-INF\classes\file.txt
  (The system cannot find the path specified)</p>
</blockquote>

<p>I am using this code to get a file: </p>

<pre><code>public File getFile (String fileName) {
    //Get file from resources folder
    ClassLoader classLoader = getClass().getClassLoader();
    File file = new File(classLoader.getResource(fileName).getFile());
    return file;
}
</code></pre>

<p>the file is in the resources folder of the project: </p>

<blockquote>
  <p>D:\Eclipse Workspace\Sentiment Analysis\example\src\main\resources</p>
</blockquote>

<p>I go the path the exception message showing and found that the file is already been there.</p>