How do I run Eclipse using Oracle's new 1.7 JDK for the Mac?

前端 未结 15 2107
执笔经年
执笔经年 2020-11-28 22:47

I\'m trying to get the new 1.7 JDK working with Eclipse (this is Oracle\'s official release).

I don\'t mean just pointing Eclipse to it so you can use it in projects

相关标签:
15条回答
  • 2020-11-28 23:13

    As of 2012-04-28, it is a known unresolved bug in Eclipse 3.7 SR2 launcher app.

    See https://bugs.eclipse.org/bugs/show_bug.cgi?id=339788

    0 讨论(0)
  • 2020-11-28 23:16

    By default, your MacOSX comes with JRE 1.6.0 which is not suitable for Eclipse. To resolve issue you also need to install JDK 7 which already includes JRE 1.7.0.

    Here is link that you can download.

    Just select MacOS X version under Java SE Development Kit 7u79 and install it.

    http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

    After installation this package, Eclipse will start without any more modification.

    0 讨论(0)
  • 2020-11-28 23:17

    Apparently there is a fix for Kepler that should come out in the next service release.

    Meanwhile, there is a workaround that is mentioned in this bug that will allow you to run eclipse without ever installing JRE 1.6 from Apple: https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361#c20

    This will allow you to launch eclipse from the finder or spotlight but not the dock.

    I've just tested this on OS X Mavericks, which during the update loses jre 6 and asks for it to be installed when you try to launch Eclipse. I have the latest Oracle JDK 1.7 installed of course.

    Decline to do that and then to work around this, edit the jvm capabilities in /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Info.plist

    <key>JVMCapabilities</key>
                <array>
                        <string>CommandLine</string>
                        <string>JNI</string>
                        <string>BundledApp</string>
                        <string>WebStart</string>
                        <string>Applets</string> 
                </array>
    

    With this fix, you don't need to specify the vm in eclipse.ini.

    0 讨论(0)
  • 2020-11-28 23:18

    Check your java_home is corrento in /usr/libexec/java_home;

    Do not change your eclipse.ini and edit the Info.plist file and change/add this line < string>-vm< /string>< string>/Library/Java/JavaVirtualMachines/'jdk-version-your'/Contents/Home/bin/java< /string> and save. Open Eclipse and done!

    For me it worked well, and to use javafx e(fx)clipse!

    PS: On a Mac OS X system, you can find Info.plist by right-clicking (or Ctrl+click) on the Eclipse executable in Finder, choose Show Package Contents, and then locate Info.plist in the Contents folder.

    0 讨论(0)
  • 2020-11-28 23:21

    I just added my comment to https://bugs.eclipse.org/bugs/show_bug.cgi?id=339788 regarding the inability to use the new Oracle JDK with Eclipse on OS X. Using the -vm option inside eclipse.ini does not work. The only way I found to work around this was to use the following shell script:

    #!/bin/sh
    #
    export JAVA_HOME=/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home
    LAUNCHER_JAR=/Applications/eclipse/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
    
    java \
    -showversion \
    -XX:MaxPermSize=256m \
    -Xms1024m \
    -Xmx1024m \
    -Xdock:icon=/Applications/eclipse/Eclipse.app/Contents/Resources/Eclipse.icns \
    -XstartOnFirstThread \
    -Dorg.eclipse.swt.internal.carbon.smallFonts \
    -Dosgi.requiredJavaVersion=1.5 \
    -jar $LAUNCHER_JAR
    

    Using the steps on http://mathiasbynens.be/notes/shell-script-mac-apps, I turned the script above into an application that I can keep on my dock.

    0 讨论(0)
  • 2020-11-28 23:22

    There is another way. Please add two following lines before -vmargs in the .ini file:

    -vm 
    {YOUR_JAVA_7_HOME}/jre/lib/server/libjvm.dylib
    

    (remember these need to be separate lines) and also add a corresponding entry in 'Info.plist' file (add or modify array items under "Eclipse" key - each string child element corresponds to a command line parameter).

    ...
    <key>Eclipse</key>
    <array>
    <string>-vm</string>
    <string>/{MY_VM_HOME}/jre/lib/server/libjvm.dylib</string>
    ...
    </array>
    

    Alternatively just use -vm {YOUR_JAVA_7_HOME}/lib/server/libjvm.dylib command line parameter when running eclipse from terminal.

    0 讨论(0)
提交回复
热议问题