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 *.java
file is actually present or exist?
Suppose name of my java file is Test.java
and it's location is src/main/java/mypackage/Test.java
. So I want to print path src/main/java/mypackage
.
I deploy my files to some server and then run it there, whever I want to print the path, I get locations like jar:file/
where no files are present.