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.
Click the Advanced tab, and then click Environment Variables. Under System Variables, look for the JAVA_HOME system variable. The JAVA_HOME path should point to the location that you recorded when you installed the JRE.
They will be listed by name. All of the 32-bit programs are installed in the Program Files (x86) directory, easily accessible using Windows Explorer. Look for the Java directory within Program Files (x86) and you will find all of the 32-bit Java packages that are installed located there. They will be listed by name.
By default, the installer places a copy of the runtime environment in the C:\Program Files\Java\jre1.
Alternatively, you can use the whereis command and follow the symbolic links to find the Java path. The output tells you that Java is located in /usr/bin/java. Inspecting the directory shows that /usr/bin/java is only a symbolic link for /etc/alternatives/java.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With