Horcrux7
Horcrux7

Reputation: 24477

How can I find the installation directory of a Java application?

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

Answers (1)

Jigar Joshi
Jigar Joshi

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

Related Questions