Failed to create the java virtual machine解决办法

换了mac笔记本,装了比较新的eclipse 4.18版本,jdk最低版本11;

查看Eclipse版本号及各个版本区别和对应JDK:https://wiki.eclipse.org/Eclipse/Installation

需要降低版本装eclipse 4.16,下载安装包之后,Eclipes installer 遇到问题:Failed to create the java virtual machine

 

尝试了各种办法都没法解决:
https://stackoverflow.com/questions/24342886/how-to-install-java-8-on-mac

https://github.com/AdoptOpenJDK/homebrew-openjdk/issues/106

https://stackoverflow.com/questions/25609405/error-could-not-create-the-java-virtual-machine-mac-osx-mavericks

先删除了已安装的jdk,重装
sudo rm -rf /Library/Java/JavaVirtualMachines/

装完之后,~/.bash_profile 中环境变量,已经jdk和java环境如下,确保正确。

wde@wdeMacBook-Pro WebRTCGlient % /usr/libexec/java_home -V

Matching Java Virtual Machines (2):

    1.8.211.12 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

    1.8.0_211 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home

wde@wdeMacBook-Pro WebRTCGlient % java -version

java version "1.8.0_211"

Java(TM) SE Runtime Environment (build 1.8.0_211-b12)

Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)

wde@wdeMacBook-Pro WebRTCGlient % echo $JAVA_HOME

/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home

wde@wdeMacBook-Pro WebRTCGlient %

最后在这里找到了解决办法:参考这里头的一个步骤:
https://stackoverflow.com/questions/62647625/not-able-to-run-eclipse-on-macos-big-sur  

  cd /Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/lib
    sudo ln -s ../jre/lib/server/libjvm.dylib libserver.dylib

 

你可能感兴趣的:(android,java,eclipse)