Thursday, 5 February 2015

Using JDK9/Jigsaw-m2 for Netbeans projects

Last updated: 2015-12-06, nightly builds (aka Development builds) now support the current JDK 9, so this post is no longer of any use.

When Jigsaw/m2 appeared on the OpenJDK, I tried it with my usual guinea pig, NetBeans. Launching was fine, however using Jigsaw as the platform for a project was not due to the new image (JEP 220). In due time it will be supported but currently it isn't. So I set out to see if I could not add some support myself.
Since I first wrote this post the NetBeans team started their work for supporting JDK 9, check the NetBeans JDK 9 support wiki page for more.

For now the following seem to work for me:
  • define a JDK 9 platform
  • class indexation and autocompletion
  • run
I tested with an own build jdk9/jdk9 (so it should also work with a recent JDK9 early access build)

To try with your own NetBeans build:
  1. Download the diff (view)
  2. Import it with Mercurial
To run NetBeans with JDK 9 yet develop for it, add the following lines to <nb working copy>/nbbuild/user.build.properties :
nbjdk.home=C:\\Program Files\\Java\\jdk1.7.0_76
# if nbjdk.home is pointing to a JDK8 then uncomment:
#permit.jdk8.builds=true
To launch an instance of NetBeans running JDK 9 via NetBeans, in <nb working copy>/nbbuild/build.xml, for the tryme target, change the value of the <arg file="${nbjdk.home}"/> of the exec task to the path to JDK9

Explore!

No comments: