Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

when I type java -versionI still get the Early Access version and not the stable JDK 7u10. please how to fix that ? I am working on Mac OS X Mountain Lion.

ls /System/Library/Frameworks/JavaVM.framework/Versions

  • 1.5.0
  • 1.6
  • 1.6.0
  • A <-- ?
  • Current <-- ?
  • CurrentJDK <-- ?

What the ? stands for please ?

/usr/libexec/java_home -V

Matching Java Virtual Machines (3):
    1.7.0_10, x86_64:   "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home
    1.6.0_37-b06-434, x86_64:   "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    1.6.0_37-b06-434, i386: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home

The problem is java -version --> java version "1.7.0_10-ea" EA !

The worst is that /Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home/bin/java -version show me the EA.

share|improve this question

migrated from stackoverflow.com Dec 20 '12 at 22:59

This question came from our site for professional and enthusiast programmers.

1  
Check your system path. I am betting that the newer JDK is not part of the path statement yet. –  Hovercraft Full Of Eels Dec 20 '12 at 21:58
    
check what exactly please ? –  Alji Dec 20 '12 at 21:58
    
I found this interesting folder : /System/Library/Frameworks/JavaVM.framework –  Alji Dec 20 '12 at 22:01
    
@HovercraftFullOfEels ... ? –  Alji Dec 20 '12 at 22:05
    
What OS are you working on? If windows, then open a command window, and type in path<return> –  Hovercraft Full Of Eels Dec 20 '12 at 22:08

1 Answer 1

up vote 1 down vote accepted

1.7 JDKs don't go into /System/Library/Frameworks, they go into /Library/Java/JavaVirtualMachines. When you run /usr/bin/java it picks the appropriate Java installation to use

  • If you have a JAVA_HOME environment variable set, then it will use that version
  • otherwise it will choose the "best" installed JDK out of the ones available in /Library/Java/JavaVirtualMachines and /System/Library/Java/JavaVirtualMachines, you can run /usr/libexec/java_home to see which one the system considers to be "best".

Of course, if you have manually added /Library/Java/JavaVirtualMachines/<something>/Contents/Home/bin to your PATH ahead of /usr/bin then java will mean that specific version rather than the one selected by the system. You can check this by running which java.

To complicate matters further, there's another copy of the JRE in /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home, which is the one used for browser plugins and for 1.7-style .app bundles that don't embed their own JRE.

share|improve this answer
    
It found three installed Java Virtual Machine but it picks a different one. It found JVM 1.7.0u10 and it picks JVM 1.7.0u10ea –  Alji Dec 20 '12 at 22:19
    
When I do java -versionI get 1.7.0_10-ea I need to get 1.7.0_10 ! –  Alji Dec 20 '12 at 22:21
    
@ALJIMohamed and is java definitely /usr/bin/java? Try which java to find that out. –  Ian Roberts Dec 20 '12 at 22:21
    
which java --> /usr/bin/java . –  Alji Dec 20 '12 at 22:24
    
I have never done anything manually. –  Alji Dec 20 '12 at 22:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.