MacOSX Snow Leopard and Eclipse: Error starting Eclipse (No Java virtual machine…)

后端 未结 7 2018
自闭症患者
自闭症患者 2020-12-18 05:46

This is so frustrating.

I did no update of java nor eclipse and suddenly I can\'t open eclipse. I even didn\'t install any other programs. Here is the error:

相关标签:
7条回答
  • 2020-12-18 06:03

    OK, after a few days of struggling and with no luck on this thread and Eclipse forums THREAD I started a bounty for this question and had no correct answer.

    I found a solution to this problem (this stack).

    ANSWER:

    You need to edit the Eclipse.app/Contents/Info.plist file and add two lines in it:

    enter image description here

    Nowhere stated that this lines had to go in Eclipse array but just somewhere up as key-string.

    If you don't have Xcode, edit that file with textedit:

        <key>Eclipse</key>
    <array>
        <string>-vm</string>
        <string>/System/Library/Frameworks/JavaVM.framework/Home/bin/java</string>
        <string>-keyring</string>
        <string>~/.eclipse_keyring</string>
        <string>-showlocation</string>
    </array>
    
    0 讨论(0)
  • 2020-12-18 06:08

    try to add this to your ~/.profile

    export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/
    export PATH=$JAVA_HOME/bin:$PATH
    
    0 讨论(0)
  • 2020-12-18 06:09

    Try moving your workspace and deleting the configs (rm -rf ~/.eclipse). Sometimes Eclipse messes up its env and needs to be reset.

    0 讨论(0)
  • 2020-12-18 06:14

    I've fixed this using a 2 step solution:

    *1. Set JAVA_HOME correctly:*

    Find out the Java JDK location:

    /usr/libexec/java_home
    

    Create the ~/.bash_profile if needed:

    touch ~/.bash_profile
    

    Edit the .bash_profile file using TextEdit, and add the following lines (change the paths as necessary):

    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/ export PATH=$JAVA_HOME/bin:$PATH

    2. Set the alias to be executable:

    From the eclipse install location, run:

    chmod +x ./eclipse
    

    Now to activate Eclipse I open Finder, navigate the to eclipse installation directory and double click the alias file (named eclipse, but without the eclipse icon).

    0 讨论(0)
  • 2020-12-18 06:17

    Editing the plist file is not the recommended way of setting the JVM. See http://wiki.eclipse.org/FAQ_How_do_I_run_Eclipse%3F#Find_the_JVM and it points you to http://wiki.eclipse.org/Eclipse.ini#Specifying_the_JVM

    Basically inside Eclipse.app/MacOS/eclipse.ini is where you'll want to specify command line arguments that get passed to eclipse by default. Granted the plist's array of arguments are also used, but that isn't how the Eclipse docs themselves recommend setting arguments (and it is possible that as a result, it might get wiped when you update Eclipse again).

    You'd want to remove the vm entry from that Array in the plist and instead add the following in the eclipse.ini before "-vmargs":

    -vm
    /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java
    
    0 讨论(0)
  • 2020-12-18 06:17

    I've encountered the same issue but a simple

    chmod +x Contents/MacOS/eclipse
    

    in the package content, did the trick.

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