Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't set JAVA_HOME because can't find where Java JDK 1.7 installed [closed]

I've just downloaded latest Java JDK for Mac OSX (jdk-7u17-macosx-x64.dmg) from here.

I have it installed, but I can't find where it has been installed so that I could setup JAVA_HOME.

notebook:work askar$ ls -al /System/Library/Frameworks/JavaVM.framework/Versions/Current
lrwxr-xr-x  1 root  wheel  1 Jul 29  2012 /System/Library/Frameworks/JavaVM.framework/Versions/Current -> A

Today is March 11, 2013. Here it shows Jul 29, 2012...

like image 872
Askar Avatar asked Dec 04 '22 00:12

Askar


2 Answers

Use the /usr/libexec/java_home utility which returns the path to the preferred JVM version.
With /usr/libexec/java_home -V you can retrieve a list of all installed JVMs.

The easiest way to set up $JAVA_HOME is:

export JAVA_HOME=$(/usr/libexec/java_home)

This will always set the path to the latest JVM, so you don't have to update it after upgrading java.

like image 78
zagyi Avatar answered Dec 06 '22 11:12

zagyi


echo `/usr/libexec/java_home`

You can use this command to find the java home in mac os.

like image 29
kannanrbk Avatar answered Dec 06 '22 09:12

kannanrbk