title: Absolute Path of Project's folder in Java
body: <p>Lots of confusion in this topic. Several Questions have been asked. Things still seem unclear.
  ClassLoader, Absolute File Paths etc etc</p>
  
  <p>Suppose I have a project directory structure as,</p>
  
  <pre>
  MyProject--
              --dist        
              --lib
              --src
              --test
  </pre>
  
  <p>I have a resource say "txtfile.txt" in "lib/txt" directory. I want to access it in a system independent way. I need the absolute path of the project.
  So I can code the path as abspath+"/lib/Dictionary/txtfile.txt"</p>
  
  <p>Suppose I do this</p>
  
  <pre><code> java.io.File file = new java.io.File("");   //Dummy file
      String  abspath=file.getAbsolutePath();
  </code></pre>
  
  <p>I get the current working directory which is not necessarily project root. </p>
  
  <p>Suppose I execute the final 'prj.jar' from the 'dist' folder which also contains "lib/txt/txtfile.txt" directory structure and resource,It should work here too. I should absolute path of dist folder.</p>
  
  <p>Hope the problem is clear.</p>