Not able to run Eclipse on macOS Big Sur

老子叫甜甜 提交于 2020-12-30 04:59:24

问题


I am not able to run eclipse on macOS Big Sur developers beta I am getting an error stating "Failed to create the java virtual machine". Is there any way to solve the error

Error pic

The java version I am running: The java version I am running is showed in the pic


回答1:


I have the same issue. solve it by add

<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/java</string>

to /Applications/Eclipse.app/Contents/Info.plist




回答2:


TL;DR

Use this to export JAVA_HOME variable:

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home

Long Version

This answer is wrt to BigSur v11.0.1 Beta. What I explored is if you have configured your .bash_profile JAVA_HOME export something like this

export JAVA_HOME=$(/usr/libexec/java_home)

Then it case it was trying to importing this, for some reason

/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

rather than

/Library/Java/JavaVirtualMachines/**/Contents/Home

For the quick fix, I configured my JAVA_HOME like this

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home

If you are switching between multiple JVMs at once then you may find this .bashrc/.zshrc configuration handy

    export JAVA_8_HOME="jdk1.8.0_231.jdk"
    export JAVA_11_HOME="openjdk-11.0.2.jdk"
    export JAVA_13_HOME="jdk-13.0.1.jdk"
    
        
    alias java8='export JAVA_HOME="/Library/Java/JavaVirtualMachines/$JAVA_8_HOME/Contents/Home"'
    alias java11='export JAVA_HOME="/Library/Java/JavaVirtualMachines/$JAVA_11_HOME/Contents/Home"'
    alias java13='export JAVA_HOME="/Library/Java/JavaVirtualMachines/$JAVA_13_HOME/Contents/Home"'
    
    # default to Java 8
    java8



回答3:


Edit the Info.plist to set the -vm value.

  1. Install the latest Eclipse version, I am using version 2020-06
  2. Right-click on Eclipse.app
  3. Show Package Contents
  4. Open Info.plist with a text editor
  5. Add -vm/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin/java under the under the key Eclipse. Note - edit the path to Java depending on what version you have. You can see the list by running /usr/libexec/java_home -V




回答4:


To fix this issue I deleted the openJDK VM and reinstalled it

  1. Delete the openJDK folder from

    /Library/Java/JavaVirtualMachines

  2. Reinstall openJDK from here

  3. Open applications and right-click spring suite > Show Package Contents

  4. Edit file Contents/info.plist. Add this

<string>-vm</string><string>/Library/Java/JavaVirtualMachines/adoptopenjdk-14.jdk/Contents/Home/bin/java</string>

This should be inside the array tag inside eclipse key




回答5:


Same thing happened to me turns out when I ran echo $JAVA_HOME the directory has been replaced,

Doing a brand new export to the java home file seemed to do the trick, I used

export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/

Seemed to do the trick, note that your directory might be different I suggest tracing to your correct directory by using "/" then tab to trace the directories.




回答6:


I solved this by using Homebrew

brew cask install eclipse-java




回答7:


Confirmed, adding below to Infolplist worked. I have Oracle jdk 8 and updated the value below. -vm/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/bin/java




回答8:


In my case I'm using a old version IDE and it's dead, already add the JAVA_HOME variable, ini and list of eclipse and not working, also noticed virtualbox is dead also can start any VM.

-vm/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home/bin/java




回答9:


I tried all solutions posted under this question; but none of them worked for me. Finally, I installed the latest version of Eclipse 2020-09 (4.17.0) to make it work.




回答10:


I upgraded to Big Sur a few days ago and also encountered this problem when I finally ran Eclipse this morning.

The latest Eclipse 2020-12 release includes its own JRE (!), thus I no longer experience "Failed to create the java virtual machine". I've left my Java versions unchanged for now as I only use Eclipse to create Tomcat webapps and do not run standalone Java.

$ /usr/libexec/java_home 
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

$ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
    1.8.121.13 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
    1.8.0_121 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
    1.7.0_60 (x86_64) "Oracle Corporation" - "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home


来源:https://stackoverflow.com/questions/62647625/not-able-to-run-eclipse-on-macos-big-sur

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!