I have run the JDK 1.8 installer from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html, and it all apparently installed correctly. But in the terminal, when I do:

  javac -version

It still reports 1.6.0_65

What am I doing wrong?

I'm using Mavericks 10.9.4


2 Answers 2


What does your .bash_profile say? There should be a line:

export JAVA_HOME=`/usr/libexec/java_home -v 1.6`

You just have to change the Java version from 1.6 to 1.8 and then reload the system variables (. ~/.bash_profile). Tried this out changing between jdk7 and jdk6. So version 8 shouldn't be an exception.


From http://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html#A1096875

Determining the Default Version of the JDK

If you have not yet installed Apple's Java OS X 2012-006 update, then you are still using a version of Apple Java 6 that includes the plug-in and the Java Preferences app. See "Note for Users of OS X that Include Apple Java 6 Plug-in".

There can be multiple JDKs installed on a system, as many as you wish.

When launching a Java application through the command line, the system uses the default JDK. It is possible for the version of the JRE to be different than the version of the JDK.

You can determine which version of the JDK is the default by typing java -version in a Terminal window. If the installed version is 8u6, you will see a string that includes the text 1.8.0_06. For example:

% java -version
java version "1.8.0_06-ea"
Java(TM) SE Runtime Environment (build 1.8.0_06-ea-b13)
Java HotSpot(TM) 64-Bit Server VM (build 23.2-b04, mixed mode)

To run a different version of Java, either specify the full path, or use the java_home tool:

% /usr/libexec/java_home -v 1.8.0_06 --exec javac -version

For more information, see the java_home(1) man page.

  • where is the new version installed?
    – Dejel
    Jan 1, 2015 at 14:29
  • /Library/Java/JavaVirtualMachines
    – oyarzun
    Jan 3, 2015 at 18:51

Not the answer you're looking for? Browse other questions tagged .