JDK9Support

(Difference between revisions)
Line 79: Line 79:
</pre>
</pre>
====Windows====
====Windows====
-
<pre> > bin\netbeans.exe --jdkhome C:\jigsaw -J-Djdk.launcher.addexports=java.desktop/sun.awt=ALL-UNNAMED,java.base/jdk.internal.jrtfs=ALL-UNNAMED,
+
<pre> bin\netbeans.exe --jdkhome "C:\Program Files\Java\jdk-9" -J-Djdk.launcher.addexports.0=java.desktop/sun.awt=ALL-UNNAMED -J-Djdk.launcher.addexports.1=java.base/jdk.internal.jrtfs=ALL-UNNAMED -J-
-
java.desktop/java.awt.peer=ALL-UNNAMED,java.desktop/com.sun.beans.editors=ALL-UNNAMED,java.desktop/sun.awt.im=ALL-UNNAMED,
+
Djdk.launcher.addexports.2=java.desktop/java.awt.peer=ALL-UNNAMED -J-Djdk.launcher.addexports.3=java.desktop/com.sun.beans.editors=ALL-UNNAMED -J-Djdk.launcher.addexports.3=java.desktop/sun.awt.im=ALL-UNNAMED -J-
-
java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED,java.management/sun.management=ALL-UNNAMED
+
Djdk.launcher.addexports.4=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED -J-Djdk.launcher.addexports.5=java.management/sun.management=ALL-UNNAMED
</pre>
</pre>
 +
If you discover you need to addExport another JDK module then add it in same way as above and increase property index for it, e.g. -J-Djdk.launcher.addexports.6=...../ALL-UNNAMED

Revision as of 17:48, 12 April 2016

Contents

JDK9 EA Support

NetBeans IDE previews early experimental support for JDK 9 EA development builds including project Jigsaw, the new modular system for Java. The NetBeans team is providing this as a preview of development work done in NetBeans IDE with the goal to have comprehensive support of JDK9 with modules (Jigsaw project) at the time of release of JDK 9. Features are not complete, at this stage, and WILL break in the future. JDK 9 and the Jigsaw project are also moving targets, which have not reach Feature Complete status yet.

The work started for Java SE support and projects (NB Ant project) other areas like Java EE or Maven are not being worked on for JDK9 EA at this time. Later when Java SE support will be in desired state NetBeans developers of all other modules should start to use this for their work on making other NB modules to support JDK 9 EA and module system.

Sources and builds are available on AS IS basis without any warranty. Bugs could be filled for JDK 9 EA support into bugzilla with Keyword JDK_9.

Features and UI is still being designed and will change. Don't use these builds for real work! A lot of exceptions ...

NetBeans JDK9 support development is done in jet-main repository on a branch jdk9. Daily builds are available at http://deadlock.netbeans.org/job/NB-for-JDK9_jigsaw/ with JavaSE build available for download from http://deadlock.netbeans.org/job/NB-for-JDK9_jigsaw/ws/dist/zip/

Regular NetBeans Development builds (planned NetBeans 8.2 release) does not fully support JDK 9 and module system.

Getting Started

  1. The NetBeans JDK 9 build runs on top of Java SE 8, you can download the latest update of Java SE 8 here. JDK 7 and older is not supported by NetBeans after NetBeans 8.1 release.
  2. Download the latest JDK 9 Early Access from https://jdk9.java.net/download/ page, build 111 or newer.
  3. Download NB JDK 9 dev build from http://bits.netbeans.org/download/ or from http://deadlock.netbeans.org/job/NB-for-JDK9_jigsaw/ws/dist/zip/ or build it from sources.
  4. Register the latest JDK 9 EA build as a Java Platform in NetBeans JDK9 build by means of Tools | Java Platforms | Add Platform.

What works

NetBeans JDK 9 builds supports:

  • NB Java SE project support one JDK9/Jigsaw module - Single module project.
  • module-info.java support: editing works and using its statement to set module boundaries for projects
  • All Editing features work according to what is declared in module-info.java
  • Using other NB Java SE Single module projects as libraries (project dependency) is possible
  • Compilation works
  • Run & Debug projects work
  • All other features unrelated to Java language like SCM should work.

What DOES NOT work

Currently all features not listed above don't work. Namely:

  • Unit tests support is not yet implemented.
  • Maven projects don't work

How to start

Add JDK9 EA as a Java Platform

image: Jigsaw_J_Platform.png

After adding JDK 9 EA as Java Platform to NetBeans create Jave SE project using New Project wizard. Setup the project to JDK9 in project Properties:

  1. In Sources customizer set Source /Binary Format to JDK 9
  2. In Libraries customizer set Java Platform to your JDK 9 EA Java platform.

Then add module-info.java. It is available under New File templates in category Java.

image: Jigsaw_New_m-i.j.png

java.base module is by default added to any Jigsaw app. You can now edit module-info.java with requires,...

image: Jigsaw_m-i.j.png

Project can have also dependency on another JDK 9 EA modular (module-info.java) NB project. Use Project Properties | Libraries customizer to add JDK 9 EA project under Modules tab using Add Project... button.

image: Jigsaw_Libs.png


Other Features

Module Dependency Graph

The Graph View of the module-info.java file provides module dependency graph.

image: ModuleGraph.png

Running NetBeans on JDK9 EA as run time Java platform

It is possible to try this NetBeans build run on JDK9 EA build. Use it with care as following command line switches might not be complete. Command lines for running NetBeans JDK 9 branch build on top of JDK9

Linux

 $ bin/netbeans --jdkhome ~/jigsaw_b96 -J-XaddExports:java.desktop/sun.awt=ALL-UNNAMED -J-XaddExports:java.base/jdk.internal.jrtfs=ALL-UNNAMED \
-J-XaddExports:java.desktop/java.awt.peer=ALL-UNNAMED -J-XaddExports:java.desktop/com.sun.beans.editors=ALL-UNNAMED -J-XaddExports:java.desktop/sun.awt.im=ALL-UNNAMED \
-J-XaddExports:java.desktop/com.sun.java.swing.plaf.gtk=ALL-UNNAMED -J-XaddExports:java.management/sun.management=ALL-UNNAMED

Mac OSX

 $ bin/netbeans --jdkhome ~/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home -J-XaddExports:java.desktop/com.apple.eawt=ALL-UNNAMED \
-J-XaddExports:java.desktop/sun.awt=ALL-UNNAMED -J-XaddExports:java.base/jdk.internal.jrtfs=ALL-UNNAMED -J-XaddExports:java.desktop/apple.laf=ALL-UNNAMED \
-J-XaddExports:java.desktop/java.awt.peer=ALL-UNNAMED -J-XaddExports:java.desktop/com.sun.beans.editors=ALL-UNNAMED -J-XaddExports:java.desktop/sun.awt.im=ALL-UNNAMED \
-J-XaddExports:java.management/sun.management=ALL-UNNAMED 

Windows

 bin\netbeans.exe --jdkhome "C:\Program Files\Java\jdk-9" -J-Djdk.launcher.addexports.0=java.desktop/sun.awt=ALL-UNNAMED -J-Djdk.launcher.addexports.1=java.base/jdk.internal.jrtfs=ALL-UNNAMED -J-
Djdk.launcher.addexports.2=java.desktop/java.awt.peer=ALL-UNNAMED -J-Djdk.launcher.addexports.3=java.desktop/com.sun.beans.editors=ALL-UNNAMED -J-Djdk.launcher.addexports.3=java.desktop/sun.awt.im=ALL-UNNAMED -J-
Djdk.launcher.addexports.4=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED -J-Djdk.launcher.addexports.5=java.management/sun.management=ALL-UNNAMED

If you discover you need to addExport another JDK module then add it in same way as above and increase property index for it, e.g. -J-Djdk.launcher.addexports.6=...../ALL-UNNAMED

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo