Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to find a $JAVA_HOME at "/usr", continuing with system-provided Java

Tags:

The output of any Java command on Mac OS X is prefixed with "Unable to find a $JAVA_HOME at "/usr", continuing with system-provided Java...". For example,

 $ java -version Unable to find a $JAVA_HOME at "/usr", continuing with system-provided Java... java version "1.6.0_43" Java(TM) SE Runtime Environment (build 1.6.0_43-b01-447-11M4203) Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01-447, mixed mode) 
like image 425
mon4goos Avatar asked Mar 28 '13 03:03

mon4goos


People also ask

How do I find my JDK path on Mac?

In macOS, the JDK installation path is /Library/Java/JavaVirtualMachines/jdk-10. jdk/Contents/Home . The root directory of the JDK software installation.

What is usr bin Java on Mac?

In summary, /usr/bin/java finds all of the JVMs under /Library/Java/JavaVirtualMachines and ~/Library/Java/JavaVirtualMachines and points to the latest JVM that has Contents/Info. plist . If you rename that file in a JVM to, say, Contents/Info.


1 Answers

The Java home environment variable is set incorrectly, possibly due to instructions from an outdated guide (e.g. EC2 Command Line Tools).

Wherever you set JAVA_HOME (e.g. .bashrc), change it to:

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

As of Mac OS X 10.5, that executable is the supported method of setting JAVA_HOME.

https://developer.apple.com/library/content/qa/qa1170/_index.html

like image 110
mon4goos Avatar answered Oct 04 '22 01:10

mon4goos