title: How to get path where my current java file is stored?
body: <p>I tried most of the answer on Stack Overflow and they give path where my .java file is not present. How to get path where my <code>*.java</code> file is actually present or exist?</p>
  <p>Suppose name of my java file is <code>Test.java</code> and it's location is <code>src/main/java/mypackage/Test.java</code> . So I want to print path <code>src/main/java/mypackage</code>.</p>
  <p>I deploy my files to some server and then run it there, whever I want to print the path, I get locations like <code>jar:file/</code> where no files are present.</p>