好吧,今天我将 Java 10 添加到我的 Windows 10 机器上,它破坏了 eclipse Neon。我的 Neon 副本不适用于 Java 10,因此我在 eclipse.ini 中明确要求它使用 Java 8。我究竟做错了什么?我很困惑。无论我的 -vm 设置如何,Neon 都会尝试使用 Java 10 来启动。
eclipse.ini
-startup
plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.401.v20161122-1740
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
C:\Program Files\Java\jdk1.8.0_121\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.8
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
Neon 尝试使用 Java 10 启动失败后的日志输出:
!SESSION 2018-05-11 17:25:40.179 ----------------------------------------------- eclipse.buildId=4.6.3.M20170301-0400 java.version=10.0.1 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US Command-line arguments: -os win32 -ws win32 -arch x86_64
!ENTRY org.eclipse.osgi 4 0 2018-05-11 17:25:42.747 !MESSAGE Application error !STACK 1 org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:386)
如果我更改 JAVA_HOME 和 Java8 目录路径上的 java bin,Neon 将运行。所以它似乎是在ini文件上读取环境变量,这似乎与我对eclipse的虚拟机狩猎过程的理解相反。
最佳答案
将 --launcher.appendVmargs
行移高两行,位于 -vm
上方。
参见Eclipse Wiki: Eclipse.ini - Specifying the JVM :
The -vm option must occur after the other Eclipse-specific options (such as
-product
,--launcher.*
, etc), but before the-vmargs
option, since everything after-vmargs
is passed directly to the JVM.
关于java - Eclipse Neon 忽略 eclipse.ini -vm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50300755/