Eclipse 4.2, Mac OS X 10.8 (ML), and Java 6

10,100

From here.

JDK 7 will be installed under /Library/Java/JavaVirtualMachines/1.7.0.jdk, JDK 6 under /System/Library/Java/JavaVirtualMachines.

To trick OS X to accept Java 7 instead of proposing to install Java 6 a simple symlink is enough:

    sudo mkdir /System/Library/Java/JavaVirtualMachines
    sudo su ln -s /Library/Java/JavaVirtualMachines/1.7.0.jdk /System/Library/Java/JavaVirtualMachines/1.6.0.jdk

Most Java Programms will run with this little hack without the need to install Java 6. 

Note that the OP in the above question specifically talks about Eclipse not working with Java 7.

Also this might be worthwhile read.

Share:
10,100
jww
Author by

jww

Updated on June 13, 2022

Comments

  • jww
    jww almost 2 years

    I'm trying to run Eclipse 4.2 (latest from website: eclipse-SDK-4.2-macosx-cocoa-x86_64) on Mac OS X 10.8 (Mountain Lion).

    I have Java 7 installed, but I keep getting prompted to install Java 6. When I choose to forgo the install by clicking "Not Now", Eclipse exits.

    $ java -version
    java version "1.7.0_05"
    Java(TM) SE Runtime Environment (build 1.7.0_05-b06)
    Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
    
    $ whereis java
    /usr/bin/java
    

    Any ideas on how to get Eclipse to work with the latest version of Java? README is lacking any useful information (and even claims Eclipse was tested with Java 7 on some platforms).


    UPDATE: Running sudo /Applications/.Eclipse/Eclipse.app/Contents/MacOS/eclipse works fine. After running under sudo and then switching back to lowly me with /Applications/.Eclipse/Eclipse.app/Contents/MacOS/eclipse results in a lock file error (permission denied).

    It appears I have two problems:

    • Running through icon click results in "Need Java 6"

    • Running from command line results in "Permission Denied"


    UPDATE: It appears to be more junk from Cupertino:

    Apple Radar: 12082976

    Here's the text that Apple wants to hide from the world:

    I purchased a new Mac Book Pro. I immediately upgraded to Mountain Lion. I installed Java 7 from Sun [Oracle]:

    $ java -version java version "1.7.0_05" Java(TM) SE Runtime Environment (build 1.7.0_05-b06) Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)

    $ whereis java /usr/bin/java

    $ /usr/libexec/java_home /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home

    When I attempt to run the Java Preferences (in /Applications/Utilities) and Eclipse, I get prompted to install Java (see attachment).

    This outdated article was no help (adding environment.plist): https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html. I thought the problem might be $JAVA_HOME was not set, but I was wrong.

    I think I got more useful information from Stack Overflow rather than the vendor (Apple), but its still not solved. https://apple.stackexchange.com/questions/58203/mountain-lion-with-java-7-only and https://apple.stackexchange.com/questions/57986/multiple-java-versions-support-on-os-x-and-java-home-location.

    Please fix this. I spends thousands on Apple hardware and hundreds on Apple software, and this sort of thing is not acceptable. I have personally wasted hours on this issue, as have others. How can the Apple QA department miss another gapping hole?

  • jww
    jww over 11 years
    That looks like a good trick (sans breaking the Control Panel applet). I'm not closing the ticket at the moment - I would like to find a solution that does not have side effects.
  • jww
    jww over 11 years
    Thanks user827992 - Java Preferences does not run. As I said, more Cupertino junk.
  • user827992
    user827992 over 11 years
    @noloader editing the eclipse.ini usually works as last option
  • jww
    jww over 11 years
    Well, I did not see an answer without side effects and Apple did not address the issue in 10.8.1. Closing as answered since this seems about as good as its going to get until Apple stops shipping broken software.
  • Dash
    Dash over 11 years
    There's no Java Preferences on Mountain Lion
  • Xavier Arias Botargues
    Xavier Arias Botargues over 10 years
    One can learn a lot from it's students, and it's not bad at all :)
  • MiB
    MiB over 10 years
    There is a Java preferences panel in Mavericks (OS X 10.9) that I assume comes with jdk7 from Oracle. u45 in my case.