[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cross-project-issues-dev] Will Your Project Work When Running on Java 9?

Hi,

Wayne recently blogged about Eclipse's Java 9 support:

 https://waynebeaton.wordpress.com/2017/03/02/eclipse-ide-oxygen-edition-and-java-9/

Also, the planning council has been discussing the Oxygen release schedule with respect to Java 9 support:

 https://dev.eclipse.org/mhonarc/lists/eclipse.org-planning-council/msg02719.html

Most projects are likely not doing anything specific to support the new feature of Java 9 so probably most of you aren't so concerned about what you need to do. But it's likely that users will install Java 9 once it's released (in July) and that makes it likely users will try to run Eclipse itself with a Java 9 VM. So the question is, will your project work when running on Java 9? Probably, but maybe not. I would strongly encourage you to test that!

Wayne's blog describes what you need to do. To make testing even easier, I've automated the setup process with an Oomph Configuration. What's a configuration you ask?

 https://wiki.eclipse.org/Eclipse_Oomph_Authoring#Automation_and_Specialization_with_Configurations

I've attached a configuration that does several things.Â

  • The installation portion of the configuration
    • adds a p2 task to reference the platform's Y build update site, i.e., the builds that contain JDT's early access Java 9 support (so whatever product you install, it will consider installing it from the Y build),
    • and adds the --add-modules VM argument to the eclipse.ini (so launching will actually function).
  • The workspace portion of the configuration
    • redirects the 4.7 I builds URL to the 4.7 Y builds URL, so if you using Oomph's targlets to provision your target platform, and provision an Oxygen target platform, it will provision one that uses the 4.7 Y builds, so you can debug launch your project code with a Java 9 IDE,
    • Âand creates a JDT "Installed JRE" that references a Java 9 JDK, and that includes the --add-modules VM argument so you can launch a self hosting IDE running on Java 9.
You can try the configuration out with the latest installer. Either update the one you have (from the menu in Simple mode or the toolbar button at the bottom in advanced mode) or download the latest one from:

 https://wiki.eclipse.org/Eclipse_Installer

To apply the configuration, you can drag and drop the email attachment to the title area of the installer (both in simple mode and advanced mode). Alternatively you can save the configuration attachment and copy the file itself (or the contents of the file), to the clipboard, and then apply it (via the menu in simple mode or via the first toolbar button next to the search field in advanced mode). If you're in simple model, applying the configuration will notice it has a workspace portion and will offer to switch to advanced mode, or will offer just apply the installation portion of the configuration. You can do either. Now you can proceed to choose a product (and optionally a project) to provision.

If you're using Java 9 for the first time, and you've only unzipped it so far, you'll need to make Oomph aware that your Java 9 JDK is available on your machine.Â
  • In simple mode you can do this as follows. Choose whatever product you want to install on the first page. On the second page, choose the "Oxygen" version of that product. For the Java VM choice, use the folder button to open the Java Virtual Machines dialog and use the Browse button to locate the Java 9 JDK on your file system. Once it's displayed, make sure it's selected and hit OK. This will create an Oxygen installation of whatever product you've chosen, configured to use a Java 9 VM along with the right VM arguments so it can actually launch successfully.
  • In advanced model you can do this as follows. Choose whatever product you want to install on the first page and choose the Oxygen Product Version. Use the folder button next to the Java VM choice and use the Browse button to locate the Java 9 JDK on your file system. Make sure it's selected in the combo box. Advance to the next page (Project page). Here you can choose your Project setup. If you don't have one, I'll bet your project doesn't have a lot of external contributors and I'll bet that you spend a lot of time on manually setting up your workspace. I typically choose the Oomph project (or EMF project) on the Project page, and then I advance to the Variables page to select the Oxygen target platform for testing against the latest platform code.
Whatever steps you take, the result will be to launch an Oxygen product based on the platform's Oxygen Y build, complete with Java 9 early access support and running on Java 9 early access JVM. If you choose a project as well, the workspace will be populated with all your source code using an Oxygen target platform also with Java 9 support and will be compiled against a Java 9 JDK. So you can launch and debug, without changing your project setup at all.

Probably your project will work just fine, but don't count on it! For example, Oomph uses a class derived from java.util.Properties in order to save properties files. The implementation of that class is changed slightly in Java 9, with the net effect that any properties file we save ends up being empty, no stack traces or other visible symptoms of the failure point. The overall effect was that any attempt to install/update anything in the IDE (or to produce an installation with the installer application) resulted in an empty config.ini. As you can imagine, a corrupted config.ini prevents the installation from running. So it was a pretty catastrophic failure! Thank goodness it's already fixed, even for the next Neon release.

During testing I also see this stack trace in my Error log:

java.lang.reflect.InaccessibleObjectException: Unable to make field private static volatile java.net.Authenticator java.net.Authenticator.theAuthenticator accessible: module java.base does not "opens java.net" to unnamed module @26749efe
ÂÂÂ at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:335)
ÂÂÂ at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:278)
ÂÂÂ at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:175)
ÂÂÂ at java.base/java.lang.reflect.Field.setAccessible(Field.java:169)
ÂÂÂ at org.eclipse.epp.internal.mpc.core.util.ProxyHelper.getDefaultAuthenticator(ProxyHelper.java:116)
ÂÂÂ at org.eclipse.epp.internal.mpc.core.util.ProxyAuthenticator.uninstall(ProxyAuthenticator.java:186)
ÂÂÂ at org.eclipse.epp.internal.mpc.core.util.ProxyHelper.uninstallAuthenticator(ProxyHelper.java:69)
ÂÂÂ at org.eclipse.epp.internal.mpc.core.util.ProxyHelper.releaseProxyService(ProxyHelper.java:60)
ÂÂÂ at org.eclipse.epp.internal.mpc.core.MarketplaceClientCorePlugin.stop(MarketplaceClientCorePlugin.java:90)
ÂÂÂ at org.eclipse.osgi.internal.framework.BundleContextImpl$4.run(BundleContextImpl.java:830)
ÂÂÂ at org.eclipse.osgi.internal.framework.BundleContextImpl$4.run(BundleContextImpl.java:1)
ÂÂÂ at java.base/java.security.AccessController.doPrivileged(Native Method)
ÂÂÂ at org.eclipse.osgi.internal.framework.BundleContextImpl.stop(BundleContextImpl.java:823)
ÂÂÂ at org.eclipse.osgi.internal.framework.EquinoxBundle.stopWorker0(EquinoxBundle.java:947)
ÂÂÂ at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.stopWorker(EquinoxBundle.java:314)
ÂÂÂ at org.eclipse.osgi.container.Module.doStop(Module.java:636)
ÂÂÂ at org.eclipse.osgi.container.Module.stop(Module.java:498)
ÂÂÂ at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.decStartLevel(ModuleContainer.java:1669)
ÂÂÂ at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1588)
ÂÂÂ at org.eclipse.osgi.container.SystemModule.stopWorker(SystemModule.java:270)
ÂÂÂ at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule.stopWorker(EquinoxBundle.java:147)
ÂÂÂ at org.eclipse.osgi.container.Module.doStop(Module.java:636)
ÂÂÂ at org.eclipse.osgi.container.Module.stop(Module.java:498)
ÂÂÂ at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202)
ÂÂÂ at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165)
ÂÂÂ at java.base/java.lang.Thread.run(Thread.java:844)

I'm not sure what to make of that, but it suggests that MPC might well not function when running on Java 9.

So in the end, I think there isn't so much to worry about, but nevertheless, I strongly encourage each team to test their project's readiness so we can all avoid hassles and embarrassment when Java 9 is finally released. I've tried to help make that as easy as possible...

Regards,
Ed

<?xml version="1.0" encoding="UTF-8"?>
<setup:Configuration
    xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xmlns:jdt="http://www.eclipse.org/oomph/setup/jdt/1.0";
    xmlns:setup="http://www.eclipse.org/oomph/setup/1.0";
    xmlns:setup.p2="http://www.eclipse.org/oomph/setup/p2/1.0";
    xsi:schemaLocation="http://www.eclipse.org/oomph/setup/jdt/1.0 http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/models/JDT.ecore";>
  <installation
      name="oxygen.java.9.early.access.beta.installation"
      label="Oxygen Java 9 Early Access Beta Installation">
    <setupTask
        xsi:type="setup.p2:P2Task"
        label="Oxygen Java 9 Early Access Beta">
      <repository
          url="http://download.eclipse.org/eclipse/updates/4.7-Y-builds"/>
    </setupTask>
    <setupTask
        xsi:type="setup:EclipseIniTask"
        option="--add-modules"
        value="=java.se.ee"
        vm="true">
      <description>This VM argument is needed to run Eclipse with the Oracle Java 9 JVM.</description>
    </setupTask>
    <productVersion
        href="index:/org.eclipse.setup#//@productCatalogs[name='self']/@products[name='empty.product']/@versions[name='version']"/>
    <description>
      Oxygen Java 9 Early Access Beta installation lets you use JDT's new &lt;a href=&quot;https://wiki.eclipse.org/Java9>Java 9&lt;/a> features.
      It assumes you also wish to run the IDE itself with Java 9 and adds --add-modules=java.se.ee to the VM args of the eclipse.ini.
    </description>
  </installation>
  <workspace
      name="oxygen.java.9.early.access.beta.workspace"
      label="Oxygen Java 9 Early Access Beta Workspace">
    <setupTask
        xsi:type="setup:RedirectionTask"
        sourceURL="http://download.eclipse.org/eclipse/updates/4.7-I-builds";
        targetURL="http://download.eclipse.org/eclipse/updates/4.7-Y-builds";>
      <description>This redirects any use of the platform's 4.7 I Builds to use the 4.7 Y builds instead.</description>
    </setupTask>
    <setupTask
        xsi:type="jdt:JRETask"
        version="JavaSE-9"
        location="${jre.location-9}"
        vmArguments="--add-modules=java.se.ee">
      <description>This creates a Java Installed JRE for a Java 9 JRE/JDK that includes the VM argumented needed to launch Eclipse IDEs.</description>
    </setupTask>
    <description>
      Oxygen Java 9 Early Access Beta workspace lets you use JDT's new &lt;a href=&quot;https://wiki.eclipse.org/Java9>Java 9&lt;/a> features. 
      It redirects the 4.7 IBuilds to the 4.7 YBuilds and sets up a Java 9 JRE.
    </description>
  </workspace>
</setup:Configuration>