Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get path to java JRE

Tags:

java

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.

like image 646
owan Avatar asked Dec 25 '10 20:12

owan


People also ask

How do I get the JRE path?

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.

Where is the JRE directory?

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.

Where is JRE path in Windows?

By default, the installer places a copy of the runtime environment in the C:\Program Files\Java\jre1.

Where is Java JRE path in Linux?

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.


1 Answers

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

like image 140
Hendrik Brummermann Avatar answered Sep 23 '22 05:09

Hendrik Brummermann