'''NOTE''' - JDK 8 or JDK 9 EA '''build 147''' is required for NetBeans development builds. More on this below in

+

[[#not_working|What does not Work chapter]].

NetBeans IDE [http://bits.netbeans.org/download/trunk/nightly/latest/ Daily Development builds] contains also early (under development) support for [https://jdk9.java.net/download/ JDK 9 EA development builds] namely the new modular system for Java. (Download http://bits.netbeans.org/download/trunk/nightly/latest/)

NetBeans IDE [http://bits.netbeans.org/download/trunk/nightly/latest/ Daily Development builds] contains also early (under development) support for [https://jdk9.java.net/download/ JDK 9 EA development builds] namely the new modular system for Java. (Download http://bits.netbeans.org/download/trunk/nightly/latest/)

Line 20:

Line 22:

## In some operating systems NetBeans, by default, launches on the most current JDK version available. Installing JDK 9 EA might cause the NB 9 daily development build, as well as other versions of Netbeans, to run with JDK 9. Although it is is possible to run the NB JDK 9 branch on JDK 9 ([[#jdk9_runtime|see below]] for instructions), you should consider configuring NetBeans (every version installed) to launch with JDK 8 (see [[#nb_faq|Changing NetBeans JDK runtime platform]] below for instructions)

## In some operating systems NetBeans, by default, launches on the most current JDK version available. Installing JDK 9 EA might cause the NB 9 daily development build, as well as other versions of Netbeans, to run with JDK 9. Although it is is possible to run the NB JDK 9 branch on JDK 9 ([[#jdk9_runtime|see below]] for instructions), you should consider configuring NetBeans (every version installed) to launch with JDK 8 (see [[#nb_faq|Changing NetBeans JDK runtime platform]] below for instructions)

'''NOTE''' - JDK 9 EA b147 or newer is required to run NetBeans development builds on top of JDK9 EA. Due to JDK bug [https://bugs.openjdk.java.net/browse/JDK-8169435 JDK-8169435] NetBeans IDE failed to start on top of b143-b146. It is fixed since b147.

+

==What works==

==What works==

Line 35:

Line 37:

==What DOES NOT work==

==What DOES NOT work==

+

<span id="not_working"></span>

+

JDK 9 EA changes in recent build 148 will require significant changes in NB daily builds. NB will '''not RUN''' on top of JDK9 EA b 148. JDK 9 EA b 148 '''CANNOT''' be used as Java Platform for IDE Java SE 9 projects. JDK9 EA build 148 introduced big changes as described in [http://mail.openjdk.java.net/pipermail/jdk9-dev/2016-November/005276.html Refresh of module system coming to jdk9/dev soon]. The fixes of this will take a time.

+

Also due to JDK bug [https://bugs.openjdk.java.net/browse/JDK-8169435 JDK-8169435] NetBeans IDE failed to start on top of b143-b146. It is fixed since b147.

+

'''If you want to run NB development build on top of JDK 9 EA then stay with b147'''. The same for using JDK9 EA as IDE project Java Platform. IDE continues to run and work with JDK8.

Features are not complete, at this stage, and WILL break in the future. JDK 9 EA is the moving targets, which have not reached 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 (daily development builds) without any warranty and testing. 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 ...

In some operating systems NetBeans, by default, launches on the most current JDK version available. Installing JDK 9 EA might cause the NB 9 daily development build, as well as other versions of Netbeans, to run with JDK 9. Although it is is possible to run the NB JDK 9 branch on JDK 9 (see below for instructions), you should consider configuring NetBeans (every version installed) to launch with JDK 8 (see Changing NetBeans JDK runtime platform below for instructions)

What works

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

Unit tests can be compiled and run.

All other features unrelated to Java language like SCM should work.

What DOES NOT work

JDK 9 EA changes in recent build 148 will require significant changes in NB daily builds. NB will not RUN on top of JDK9 EA b 148. JDK 9 EA b 148 CANNOT be used as Java Platform for IDE Java SE 9 projects. JDK9 EA build 148 introduced big changes as described in Refresh of module system coming to jdk9/dev soon. The fixes of this will take a time.
Also due to JDK bug JDK-8169435 NetBeans IDE failed to start on top of b143-b146. It is fixed since b147.
If you want to run NB development build on top of JDK 9 EA then stay with b147. The same for using JDK9 EA as IDE project Java Platform. IDE continues to run and work with JDK8.

Multiple JDK9 modules in one NB project

How to start

This chapter uses NetBeans Java SE project type, based on Apache Ant.

Add JDK9 EA as a Java Platform

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:

Project dependencies

Project can have also dependency on another JDK 9 EA modular (module-info.java) NB project. Use Project Properties | Libraries customizer to add another project either into modulepath or classpath. Use Add Project... button.

This customizer was redesigned from previous NetBeans versions to adapt to coexistence of modulepath and classpath in JDK 9.

JUnit tests

NetBeans currently supports JUnit tests which are part of same module as tested sources. If interested how modulepath, classpath, addExport, addmods, addReads are handled to run Junit tests then read this thread: JUnitTask + JDK9 question

The structure is very similar to non-modular Java development. Simply add JUnit tests into Test Packages or leverage existing JUnit tests in a project. Then run the tests using project context menu 'Test Alt+F6 or Test File (Ctrl+F6) for single Java file.

JUnit tests in own module

NetBeans also support inside Java SE single module project to place tests inside own module. This is the only case when two module_info.java files can be used in this type of project. This way tests are more like black box as they are not a part of source module, thus module boundaries and package readability among modules play a role.

Start by adding module_info.java into Test Packages. Rename the module to something meaningful and different from source files, e.g. testModule
Then add JUnit tests into some package. Resulting structure should look like following screen shot:

module_info.java looks like following:

NetBeans perform compilation and test execution which could replicated using these two command lines (just for illustration) using Ant junit task:

Maven Projects

With release of Apache Maven Compiler Pluging v 3.6.0 it is possible to develop Maven projects in NetBeans 9 for JDK9. Simply open or create Maven project in NetBeans IDE. Set appropriate JDK 9 EA as Project Java Platform and change Source/Binary Format to 9.
If module_info.java is present in Maven project then all Java libraries used in a project became JDK9 modules - are placed to MODULEPATH by Maven Compiler Plugin.
It is also possible to add declared dependencies to module_info.java via a context action on the dependency node.

NetBeans Maven support is under development to provide other productivity features for Maven projects.

maven-surefire-plugin

Unit tests are not working, waiting for Maven Surefire plugin to support JDK9.

Other Features

Module Dependency Graph

Running NetBeans on JDK9 EA as run time Java platform

It is possible to try this NetBeans build to run on JDK9 EA build as NetBeans IDE runtime platform. Use it with care as JDK9 EA is still under development as well as NetBeans JDK9 branch. We adopt NetBeans JDK9 to JDK9 EA changes but in some cases it takes some time.

Necessary command line options are in nb_install_dir/etc/netbeans.conf file. If you discover you need to -add-export another JDK module then add it in this file and file a bug for NB JDK9.