2
votes

Well, today I added Java 10 to my Windows 10 machine and it broke eclipse Neon. My copy of Neon doesn't work with Java 10, so I explicitly ask it to use Java 8 in eclipse.ini. What am I doing wrong? I'm stumped. Neon keeps trying to use Java 10 to launch, regardless of my -vm setting.

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

log output after failed launch with Neon trying to use 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)

This is the message I get from Eclipse when it crashes. enter image description here

If I change JAVA_HOME and the java bin on my path to Java8's directories, Neon will run. So it seems to be reading env vars over the ini file, which seems backwards to my understanding of eclipse's vm hunting procedure.

1

1 Answers

3
votes

Move the line --launcher.appendVmargs two lines higher, above -vm.

See 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.