eclipse.ini中针对Eclipse IDE 2020-09版本的特定JDK使用JDK 15,而不是默认JDK在系统环境变量中声明的内容

问题描述

Eclipse 2020-09,错误

Version 1.8.0_261 of the JVM is not suitable for this product. Version: 11 or greater is required.

enter image description here

在某些情况下,我必须将Java环境设置为JDK 1.8才能使Gradle正常工作。

enter image description here

文件eclipse.ini

-startup
plugins/org.eclipse.equinox.launcher_1.5.800.v20200727-1323.jar
--launcher.library
C:\Users\donhuvy\.p2\pool\plugins\org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1300.v20200819-0940
-product
org.eclipse.epp.package.jee.product
-showsplash
C:\Users\donhuvy\.p2\pool\plugins\org.eclipse.epp.package.common_4.17.0.20200910-1200
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=11
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYstem
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitinit=true
-xms256m
-Xmx2048m
--add-modules=ALL-SYstem
-Declipse.p2.max.threads=10
-Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/
-vm C:\Program Files\Java\jdk-15\bin\

但是Eclipse仍然无法启动。

我的PC中的JDK:

enter image description here

如何将JDK 15声明为eclipse.ini

解决方法

-vmC:\Program Files\Java\jdk-15\bin\javaw.exe必须直接在-vmargs行之前两行,而不是在该行之后(请参阅Eclipse wiki: eclipse.ini - Specifying the JVM):

-startup
plugins/org.eclipse.equinox.launcher_1.5.800.v20200727-1323.jar
--launcher.library
C:\Users\donhuvy\.p2\pool\plugins\org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1300.v20200819-0940
-product
org.eclipse.epp.package.jee.product
-showsplash
C:\Users\donhuvy\.p2\pool\plugins\org.eclipse.epp.package.common_4.17.0.20200910-1200
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
C:\Program Files\Java\jdk-15\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=11
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
-Declipse.p2.max.threads=10
-Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/
,

我从https://jdk.java.net/archive/

获得openJdk11

然后将其解压缩到本地驱动器:(例如:C:\ work \ tool \ 202009 \ jdk-11.0.2)

接下来,编辑eclipse.ini,添加一行代码:

-虚拟机 C:\ work \ tool \ 202009 \ jdk-11.0.2 \ bin

再次启动Eclipse即可。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...