java - Eclipse Neon 忽略 eclipse.ini -vm

标签 java eclipse

好吧,今天我将 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)

这是我在 Eclipse 崩溃时收到的消息。 enter image description here

如果我更改 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/

相关文章:

java - 匹配两个字符串,一个与 x,另一个与任意字符

java - 保留服务器 : how to terminate a blocking instance (eval taking forever)?

java - AppCompatImageView 无法转换为 ViewGroup

java.lang.IllegalAccessException : Class z. y.x.u.SimpleCompileTest 无法使用修饰符 ""访问类 MyClass 的成员

java - 将我的数据库移动到 SD 卡不起作用

python - 如何卸载从 *.txt 文件安装的 pip 包?

java - 获取FTP服务器中的隐藏文件

java - Eclipse JSP 编辑器中的堆栈溢出

c++ - 带有 Qt 集成的 C++ 中的无效参数

eclipse - Eclipse 无法识别常见目标