Vivoco
Vivoco

Reputation: 231

What is the path to the JRE file?

I am looking for the path the the JRE file on Mac OS X 10.6.8. Or is there no such file? Is JRE just slang for an idea or concept? Java Runtime Environment is a real thing.

Does it have a file? I am installing something that asks for the path to the JRE file http://www.boonex.com/trac/dolphin/wiki/RayMediaServerInstallation

Upvotes: 23

Views: 104569

Answers (8)

pasignature
pasignature

Reputation: 585

On Mac just type echo $JAVA_HOME in the terminal and you well get the following:

/Library/Java/JavaVirtualMachines/jdk-11.0.19+7/Contents/Home

Then, type open .

this will open the Home folder

Upvotes: 0

not2savvy
not2savvy

Reputation: 4243

Run /usr/libexec/java_home in a terminal. It will return the path that corresponds to $JAVA_HOME for your Mac's default Java installation. Attach /jre to this path to get the Java runtime environment (JRE) path.

Example:

$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home

JRE would be /Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/jre

To verify:

$ ls -al /Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home/jre
total 552
drwxr-xr-x  10 root  wheel     340 Apr  2  2019 .
drwxr-xr-x  15 root  wheel     510 Apr  2  2019 ..
-r--r--r--   1 root  wheel    3244 Apr  2  2019 COPYRIGHT
-r--r--r--   1 root  wheel      44 Apr  2  2019 LICENSE
-r--r--r--   1 root  wheel      46 Apr  2  2019 README
-rw-r--r--   1 root  wheel  112748 Mar 14  2019 THIRDPARTYLICENSEREADME-JAVAFX.txt
-r--r--r--   1 root  wheel  149725 Apr  2  2019 THIRDPARTYLICENSEREADME.txt
-r--r--r--   1 root  wheel     955 Apr  2  2019 Welcome.html
drwxr-xr-x  13 root  wheel     442 Apr  2  2019 bin
drwxr-xr-x  98 root  wheel    3332 Apr  2  2019 lib

This also works with any OpenJDK installation:

$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home

Versions

If you have multiple JREs or JDKs installed, you can obtain $JAVA_HOME for a specific version using the -v option:

$ % /usr/libexec/java_home -v 11  
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home

Tipp

To set the JAVA_HOME environment variable, use

$ export JAVA_HOME=`/usr/libexec/java_home`
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home

Upvotes: 4

Nico
Nico

Reputation: 635

If you installed jre by dmg.

You can find your "java" at

/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java

and you can check version by command:

/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version

Upvotes: 2

Mike S.
Mike S.

Reputation: 2778

After installing the latest JRE8 (as of today update 131), do the following :

In your .bash_profile add the following

export JAVA_HOME='/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home'

Then add that to your path export PATH=$PATH:$JAVA_HOME. Save and open a new terminal. Type java -version. You should see output like this:

->java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

Upvotes: 19

Genie Tsai
Genie Tsai

Reputation: 49

On El Capitan with Java 8, here is a way to check the path of jre. Go "System Preference/Java", then go third tab "Java" and click "View". Then you can get the JRE path, which is /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/

Upvotes: 4

Steve Harris
Steve Harris

Reputation: 306

The /System/Library/Frameworks/JavaVM.framework/Home answer used to be correct.

With Oracle Java 8 (and later?) on MacOSX Sierra the /System/Library/Frameworks/JavaVM.framework/Home doesn't exist.

The answer for /Library/Java/JavaVirtualMachines/ is much closer. For the JDK at /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Content/Home, for instance, just add /jre to the end of that path for the JRE.

Upvotes: 1

Aris Bartee
Aris Bartee

Reputation: 728

On the mac, set JAVA_HOME to "/System/Library/Frameworks/JavaVM.framework/Home"

The JRE is not a file. The JRE is the java runtime environment and is made up of many files. The convention for java is to specify the JAVA_HOME. That is a directory containing a bin folder.

Upvotes: 22

sam
sam

Reputation: 598

In Mac you can find Java JRE's installed in the following folders

/Library/Java/JavaVirtualMachines/

Example /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home.

Upvotes: 21

Related Questions