Marc
Marc

Reputation: 115

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:

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

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.

Upvotes: 2

Views: 2576

Answers (2)

papigee
papigee

Reputation: 7368

After installing Java 9, these steps worked for me:

  • Right Click On the project and select “Configure Build path”
  • Select the "Libraries" tab at the top. If jre8 is still there, select it and press Remove from the tabs on the right.
  • Select “Add Library” and then “JRE System Library” the Select jre9.
  • Confirm that "Execution Environment is using JRE9 as shown in the picture
  • Apply and close

After doing that check the eclipse.ini fil at ~\eclipse\jee-oxygen\eclipse\eclipse.ini and make sure there is no -vm option there. If it is, delete the entire option and the JRE path i.e: -vm. C:/Program Files/Java/jre1.8.0_151/bin. This will cause Eclipse to figure out the Java version to use.

enter image description here

enter image description here

enter image description here

Upvotes: 0

greg-449
greg-449

Reputation: 111142

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.

Upvotes: 1

Related Questions