Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

after installing java 1.8 jdk javac still reports 1.6

if I do:

/usr/libexec/java_home -v 1.8.0_31 --exec javac -version Unable to find any JVMs matching version "1.8.0_31". javac 1.6.0_65
Notice how
--exec javac -version
in the previous one-liner does find the javac, but it reports the old 1.6. How do I fix my paths so that javac works?

mbp mac os x yosemite 10.10.1 trying to run some apps on Eclipse luna

MacBook Pro, OS X Yosemite (10.10.1)

Posted on Feb 1, 2015 7:55 AM

Reply
15 replies

Feb 5, 2015 2:39 PM in response to saguinag

I can get Java 1.7 installed and when I go to eclipse Luna and search for installed JRES (from Preferences/Java/) Java SE 1.7 is found.


But when I compile JettyHTTPServer.java (in SIRS from Github NDDSG by Tim Weninger) I get the following error still:

Exception in thread "main" java.lang.UnsupportedClassVersionError: edu/nd/sirs/webapp/JettyHTTPServer : Unsupported major.minor version 52.0

if I switch to the Plug-In Java 1.8 ... it compiles, but when I try to access the localhost server, the server chokes!


Java 1.7 is found on my system at: /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home


What is weird, is that Java 1.8 jdk is not in this folder!


Instead, that JRE is locate at /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home


I guess, I could try uninstalling the Plug-In and try to re-install Java 1.8? Any ideas?

Feb 5, 2015 3:07 PM in response to saguinag

Got this issue fixed. Notice that above I had said that Java 1.8 got installed but only as a Plug-In. I did not appear to have installed the complete JDK. I had to remove the Plug-In and reinstall Java 1.8


sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin


java -version

java version "1.8.0_31"

Java(TM) SE Runtime Environment (build 1.8.0_31-b13)

Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)


Now I need to change my symbolic link for javac:

Before:

javac -version

javac 1.7.0_75


After:

$ sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javac javac

$ javac -version

javac 1.8.0_31


Now everything works

HTH

Aug 1, 2015 5:31 AM in response to saguinag

I am having a problem installing Java 8 51, but a) the thread above is way beyond my technical level and b) having tried to post my question, I am dumbfounded by how to find an appropriate community. (If I try "Mac OS X Technologies" I am forced to choose a sub-category from a selection that do not seem to cover this issue in any way.


You appear to be a power user of the community, perhaps you could give me a steer to how to post. My question is:


I have installed Java 8 51, it completes, verifies (with Oracle) but Terminal "java -version" still says 1.6_65.


Running OS 10.10.4, using Firefox 39, (Java 8 51 appears in Add-ons)


Any ideas (in relatively lay terms pls 🙂) ?


Thnx,

Aug 1, 2015 4:53 PM in response to terry82

If you want to determine the installed Java 8 JRE, run this in the Terminal app, not java -version:


/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version


java version "1.8.0_51"

Java(TM) SE Runtime Environment (build 1.8.0_51-b16)

Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)


Whereas, for Java 6 JRE, java -version shows:


java version "1.6.0_65"

Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)

Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)

Since that's what you're showing, it just means that you also have JRE SE 6 installed. Nothing wrong with having both installed. I have both.


27" i7 iMac (Mid 2011) refurb, OS X Yo (10.10.4), Mavs, ML & SL, G4 450 MP w/10.5 & 9.2.2

Oct 5, 2015 9:52 PM in response to saguinag

How does this help?


If I remove the plugin and then run the installer again, all it does is it reinstalls the plugin.


java -version still returns

java version "1.6.0_65"

Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4828a)

Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)

.


Nothing has changed. What am I missing?

Oct 5, 2015 10:28 PM in response to baltwo

Ok, fair enough, you can have 2 versions installed. But how can I make the version 1.8 the default version? Like usually the latest version automatically becomes the 'currentVersion'.


I guess for the command line I could change my $PATH to contain /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/ before /usr/bin . But how can I get applications like Eclipse to find that version? Create symbolic links in standard locations to the executables in the plugin ?


Is there a reason that version 1.8 is only installed as an internet plugin instead of standard locations?

If it is intended, why does the installer not create the necessary links and path entries?


Requiring the user to do that manually seems like a hack and not very Mac like. It feels to me as if something must be wrong.


Thanks for any help making this clearer.

Oct 8, 2015 8:26 PM in response to baltwo

baltwo wrote:


You don't need to make either the default version. Programs requiring one or the other will use the one they need. They're both active, but only come into play when needed.


Then why won't Eclipse find it and instead show me at start up that it requires Java SDK 1.7 or above and it cannot run on the version 1.6 it found?


I found that several people asked the question of different sites about why Eclipse doesn't find the right version. Usually the answer is that you have to use the 64 bit version, not the 32 bit version. So I made sure to download the 64 bit version. (I'm relying here on that what's written on the box is really what's in the box.)

But all those guys having problems with Eclipse usually state that when they type the command 'java -version' in the terminal that the latest version gets found and therefor the result is a java version greater than 1.6. However in my case I always get the result 1.6, even though the version 1.8 is installed as well. I only get the result 1.8 if I specify the whole path to java, which is in the plugins directory mentioned in earlier posts. Therefor I assume that in my case even the 64 bit version of Eclipse ends up with the old version and won't start.


Any ideas what the problem might be with my setup, or what I could do to make it work as you describe? (I mean that programs can find the version they need)

after installing java 1.8 jdk javac still reports 1.6

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