27

I installed jdk 1.8.0 u5, but the command line java is reporting 1.7:

$ java -fullversion
java full version "1.7.0_51-b13"

$ which java
/usr/bin/java

$ ls -l /usr/bin/java
lrwxr-xr-x  1 root  wheel  74 Oct 23  2013 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

Here is what is installed

$ ls -l /System/Library/Frameworks/JavaVM.framework/Versions/
total 64
lrwxr-xr-x  1 root  wheel   10 Oct 23  2013 1.4 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Oct 23  2013 1.4.2 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Oct 23  2013 1.5 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Oct 23  2013 1.5.0 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Oct 23  2013 1.6 -> CurrentJDK
lrwxr-xr-x  1 root  wheel   10 Oct 23  2013 1.6.0 -> CurrentJDK
drwxr-xr-x  8 root  wheel  272 May 13 10:21 A
lrwxr-xr-x  1 root  wheel    1 Oct 23  2013 Current -> A
lrwxr-xr-x  1 root  wheel   59 Oct 23  2013 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents

also:

$ /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java -fullversion
java full version "1.7.0_51-b13"

The java control panel applet reports 1.8, but in /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/

Any idea where it went?

2

2 Answers 2

18

Java 7 and Java 8 are installed under /Library/Java/JavaVirtualMachines, and to get informations about the installed Java VM's you can use the /usr/libexec/java_home command, which is a link/shortcut to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home.

Some of the command to use are:

/usr/libexec/java_home -verbose will give you all installed versions with path.

/usr/libexec/java_home -v '1.6*' will give you JAVA_HOME of Java 6

/usr/libexec/java_home -v '1.7*' will give you JAVA_HOME of Java 7 (if installed)

/usr/libexec/java_home -v '1.8*' will give you JAVA_HOME of Java 8 (if installed)

And if /usr/libexec/java_home is called without any parameters you should get the current enabled (newest) Java version. If you don't get the newest Java version when /usr/libexec/java_home is called, you can try a restart of your Mac, so that the system reload its current load of the /usr/bin/java link/shortcut to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

25

I had the same problem on OS X Yosemite 10.9.

The problem was solved by installing the Java SE Development Kit 8.

I had installed the other version that is not a SE development kit and it was just working in web browsers, not for the terminal.

3
  • I installed the JDK, as you suggested, and everything works now. Many thanks!!
    – rmbianchi
    Oct 17, 2015 at 14:31
  • Worked for me! been trying to find jdk8 and finally this fixed my issue. thanks
    – Bun
    Mar 24, 2016 at 23:55
  • 1
    I needed to do this, but still had problems because my .bash_profile had JAVA_HOME pointing to /Library/Java/Home, where 1.6 was installed.
    – David
    Dec 13, 2016 at 11:26

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