saguinag

Q: 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

Close

Q: after installing java 1.8 jdk javac still reports 1.6

  • All replies
  • Helpful answers

  • by mcamanju,

    mcamanju mcamanju Feb 3, 2015 5:25 PM in response to saguinag
    Level 1 (0 points)
    Feb 3, 2015 5:25 PM in response to saguinag

    I am facing same problem too and unable to open Eclipse luna

    MacBook Pro, OS X Yosemite (10.10.2)

  • by saguinag,

    saguinag saguinag Feb 5, 2015 2:39 PM in response to saguinag
    Level 1 (0 points)
    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?

  • by saguinag,

    saguinag saguinag Feb 5, 2015 3:07 PM in response to saguinag
    Level 1 (0 points)
    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

  • by terry82,

    terry82 terry82 Aug 1, 2015 5:31 AM in response to saguinag
    Level 1 (0 points)
    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,

  • by baltwo,

    baltwo baltwo Aug 1, 2015 4:53 PM in response to terry82
    Level 9 (62,256 points)
    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

  • by jeAdc,

    jeAdc jeAdc Oct 5, 2015 9:52 PM in response to saguinag
    Level 1 (0 points)
    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?

  • by jeAdc,

    jeAdc jeAdc Oct 5, 2015 10:28 PM in response to baltwo
    Level 1 (0 points)
    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.

  • by baltwo,

    baltwo baltwo Oct 6, 2015 11:23 PM in response to jeAdc
    Level 9 (62,256 points)
    Oct 6, 2015 11:23 PM in response to jeAdc

    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.

  • by jeAdc,

    jeAdc jeAdc Oct 8, 2015 8:26 PM in response to baltwo
    Level 1 (0 points)
    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)

  • by baltwo,

    baltwo baltwo Oct 12, 2015 12:19 PM in response to jeAdc
    Level 9 (62,256 points)
    Oct 12, 2015 12:19 PM in response to jeAdc

    Haven't a clue, since I don't own or use Eclipse. You'll have to contact them to find out what's going on.

  • by domjumo,

    domjumo domjumo Oct 18, 2015 12:30 PM in response to terry82
    Level 1 (0 points)
    Oct 18, 2015 12:30 PM in response to terry82

    make sure you actually downloaded jdk not jre

     

    if you want to develop programs, you need to have java development kit (idk)

  • by SimonWEC,

    SimonWEC SimonWEC Nov 26, 2015 4:37 AM in response to domjumo
    Level 1 (0 points)
    Nov 26, 2015 4:37 AM in response to domjumo

    Hello,

     

    I had exactly the same frustrating issue - I use Eclipse as my principle IDE and couldn't get the latest version installed due to Java version problems on Yosemite.

     

    Did as above suggested: downloaded 1.8 JDK (not JRE!!); installed; installed latest Eclipse with no issues; happy chap

     

    #Simon

  • by AlzD,

    AlzD AlzD Feb 9, 2016 1:07 PM in response to SimonWEC
    Level 1 (0 points)
    Feb 9, 2016 1:07 PM in response to SimonWEC

    Thaaanks!