How to get Eclipse Oxygen to run on Java 9

五迷三道 提交于 2019-12-24 00:45:47

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/46336547/how-to-get-eclipse-oxygen-to-run-on-java-9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!