System Preferences show Java 8 but system uses Java 7

Hi. I have 10.11.6 installed on my Mac. When I view the latest Java version System Preferences -> Java -> Update I see Java 8 Update 121. Yet, when I open a terminal window and enter Java -version I see java version "1.7.0_79". Further when I enter /usr/libexec/java_home -V I see:

Matching Java Virtual Machines (3):

1.7.0_79, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home

1.6.0_65-b14-468, x86_64: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

1.6.0_65-b14-468, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home


Can anyone explain why the system preferences show Java 8, but at the terminal-window level I see Java 7? In the end I want to run a java application that requires Java 8. How can I set my Mac to actually use Java 8?

Thanks for the help.

Posted on Jan 28, 2017 6:07 AM

Reply
4 replies

Jan 29, 2017 7:48 AM in response to michael59c

I'm going to ask a simple question.

This is just to make sure we try the simple solution before anything more drastic (like removing and re-installing Java).


The Java preferences panel lists the most recent version available, and then lists the version on your computer.

Are they both showing the same Java 8 version?


For example, I'll have to update my version, because I see this on my laptop:

8 Update 121 build 13 (62 MB)

Your current version is Java 8 Update 111.

Jan 29, 2017 9:33 AM in response to michael59c

I'm not an expert with Java, so a lot of this is guesswork and looking around discussion forums.

But hopefully I'm steering you in the right direction.


You have several older versions of Java in your system, and in recent years both Java and MacOS have changed which environment variables, commands, and paths are used for a particular version. It is possible that java_home was not updated? I'd put more trust in what version is reported by the executable.

MacBook:~ me$ java -version java version "1.8.0_25"


Just to make sure we are on the same page, my /usr/libexec/java_home is a symbolic link to /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home

It might not hurt to check your .profile or bashrc files to see if there are any (outdated) Java settings hiding.


Or if the "Current" symbolic link is pointing to the right version:

MacBook:~ me$ cd /System/Library/Frameworks/JavaVM.framework/Versions/

MacBook:Versions me$ ls -al

drwxr-xr-x 10 root wheel 340 Jul 30 2016 A

lrwxr-xr-x 1 root wheel 1 Nov 7 2015 Current -> A


Oracle recommends blowing away old versions of Java (for security reasons). Unfortunately, the Java web site gives instructions for Windows users to remove old Java versions, but the only info they give for Mac users is to uninstall/re-install.

https://www.java.com/en/download/help/mac_uninstall_java.xml


I found this discussion interesting.

http://superuser.com/questions/479372/java-version-reporting-wrong-version-on-ma c-osx-mountain-lion

It is old (Mountain Lion and Java 7), but the point is that even something as simple as installing from different sources (JRE vs. JDK) would make it confusing about which version of Java is being used. (The two install versions use different paths and environment variables.)


Hope something in there helps!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

System Preferences show Java 8 but system uses Java 7

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.