Reputation: 137
Is is possible to find my executable jar file running location, from that jar file jave code,
For example I may run one particular jar file from d:\test\finloc.jar, It should print the path as
d:\\test
I may run from C:\users\GJ\Documents\findloc.jar, then its output should be like
C:\\users\GJ\\Documents\\
Upvotes: 0
Views: 424
Reputation: 10240
Following code outputs the path from where the application starts.
In your case, the jar file.
System.getProperty("user.dir");
Upvotes: 2