Search code examples
macosjava-9eclipse-oxygen

How to get Eclipse Oxygen to run on Java 9


I desperately try to get Eclipse Oxygen to run Java 9 on Mac OSX, but I somehow seem to fail.

Steps I have done so far:

  • Installed the Java 9 JDK in /Library/Java/JavaVirtualMachines/jdk-9.jdk (next to the already installed /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk)

  • Installed the "Java 9 Support (BETA) for Oxygen 4.7" plugin from the Eclipse market place (I have Oxygen 4.7 for Java EE Developers installed)

  • Added the line "--add-modules=java.se.ee" after the -vmargs line in eclipse.ini (as suggested here: With java 9 ea, Eclipse fails to install and show error "An error has occurred, see the log file null") to avoid startup problems

  • Set the Compiler compliance level in the settings to "9 (BETA)"

  • Added the Java 9 SDK to the installed JREs and made it the default choice

Now, at the startup of my program, I print out all the System.getProperty() values. And I get for example

  • java.runtime.version: 1.8.0_144-b01

  • java.specification.version: 1.8

  • java.vm.specification.version: 1.8

  • java.version: 1.8.0_144

Why?! What else is there to do to tell Eclipse that it shall for gods sake not use Java 8 but Java 9?

One reason I need Java 9 is the new security feature OCSP Stapling for TLS (see https://docs.oracle.com/javase/9/security/java-pki-programmers-guide.htm#JSSEC-unique_4307382).

There is the system property "jdk.tls.server.enableStatusRequestExtension" which, when currently queried, returns "null", but it should return "false" with Java 9:

getLogger().debug("enableStatusRequestExtension: " + System.getProperty("jdk.tls.server.enableStatusRequestExtension"));

I hope you can help me here.


Solution

  • To run your program using Java 9 do the following:

    Open the Preferences and go to 'Java > Installed JREs'. Add the Java 9 JDK if it is missing.

    In the Properties for the Java project select the 'Java Build Path' entry and choose the 'Libraries' tab. Edit the 'JRE System Library' entry and choose the Java 9 JDK or a Java 9 Execution environment.

    You also need to look at the 'Run Configuration' for your program ('Run > Run Configurations'). Check that JRE setting is 'Project execution environment' or a Java 9 JDK / Execution environment.