Reputation: 24477
I need to find the installation directory of a Java application. I will use it to find recourses that are not on the classpath. What is the best solution for it?
Upvotes: 0
Views: 1506
Reputation: 240966
This code will give you the location of class file in System from where it is being executing.
this.getClass().getProtectionDomain().getCodeSource().getLocation();
Upvotes: 2