title: Java: Relative path to external text file
body: <p>I am a bit confused with path in Java (using Eclipse). This is my file structure:</p>
  
  <pre><code> Folder
  
      Subfolder
  
          file.txt
  
      jarfile.jar
  </code></pre>
  
  <p>So, I am trying to make the jar file parse data from file.txt and I use the following code:</p>
  
  <pre><code>Scanner in = new Scanner(this.getClass().getResourceAsStream("./Subfolder/file.txt"));
  </code></pre>
  
  <p>I have made a runnable jar file with Eclipse, put it in the Folder, but it does not work. What is it that I am doing wrong?</p>