mobibob
mobibob

Reputation: 8794

What path does one specify for JAVA_HOME on a Mac OS environment?

When an application or plug-in install states that the JAVA_HOME variable point you my JDK, what export statement do I need to put in my .bash_profile?

Upvotes: 3

Views: 2993

Answers (3)

Telles Nobrega
Telles Nobrega

Reputation: 1

I agree with Valko Sipuli.

I'm using Mac OS Yosemite and

JAVA_HOME=$(/usr/libexec/java_home)

did the trick for running ant.

Upvotes: 0

Make Mark
Make Mark

Reputation: 3755

The proper way to set JAVA_HOME is to invoke the java_home(1) tool (see http://developer.apple.com/library/mac/#qa/qa1170/_index.html). This can be done as follows to use defaults:

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

Upvotes: 9

revdrjrr
revdrjrr

Reputation: 1045

Browse to: /System/Library/Frameworks/JavaVM.Framework/Versions/

Then, pick an alias to a version or 'CurrentJDK'.

export JAVA_HOME=/System/Library/Frameworks/JavaVM.Framework/Versions/CurrentJDK/Home

then add $JAVA_HOME to your PATH.

Upvotes: 4

Related Questions