Technical note book of Chatura Dilan

How to set JAVA_HOME in Mac OSX Mavericks

If you face trouble with setting up JAVA_HOME in mac OSX, here is the solution. Mavericks picks a path to Java 1.6 version as the default JAVA_HOME version.

To change it

  1. Go to /System/Library/Frameworks/JavaVM.framework/Versions
  2. Remove the CurrentJDK link
  3. add new link to /Library/Java/JavaVirtualMachines/jdk<version>.jdk/Contents/Home as CurrentJDK
cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo rm -rf CurrentJDK
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents CurrentJDK

One thought on “How to set JAVA_HOME in Mac OSX Mavericks

  1. I have not installed, and do not need, the JDK. I need only the JRE to support a couple of applications that I use. I want to use the latest version of the JRE, rather than the older version that Apple now supplies. My OSX is 10.9.4, and I’ve just installed Java 1.7.0_60 from Oracle.

    $ ‘java -version’ indicates that 1.7.0_60 is installed, but:

    $ /usr/libexec/java_home -V reports that both Java VMs are the 1.6.0_50 version!?

    Also, the folder ‘/Library/Java/JavaVirtualMachines’ is empty. Perhaps this is as it should be for a JRE-only installation.

    Can you tell me how (or if) I should set java_home to the latest version?

    danke!

Leave a Reply

Your email address will not be published. Required fields are marked *