Reputation: 341
It it possible to get the location of the jre that is used for the current process. Need to launch an other java application as a separate process. Having different jre's available (and no path variable set) I would like ask eg. the loader for this. Running on Solaris, Linux, Windows.
Upvotes: 34
Views: 29587
Reputation: 11
System.out.println(System.getProperty("java.home"));
The code above will return the full physical path to current jvm's jre path. Tested only in Windows 10.
Upvotes: 1
Reputation: 8312
You can use:
System.getProperty("java.home")
http://download.oracle.com/javase/6/docs/api/java/lang/System.html#getProperties%28%29 says:
java.home: Java installation directory
Upvotes: 47