Updated for NetBeans 12: Using the Netbeans IDE to work on JDK library development

Bradford Wetmore bradford.wetmore at oracle.com
Wed Jun 10 22:49:23 UTC 2020

[This updates earlier versions of this document to Netbeans 12.]

Apache's NetBeans 12 continues to progress nicely.  The startup time 
seems speedier than 11.*.  Developing/debugging JDK 14/15 library builds 
(both exploded and image) seems stable and very usable.  Working on a 
recent significant codereview was enjoyable: I applied the jdk.patch 
file from a webrev, then compiled/debugged and all went smoothly.

Note Well: I'm not a Netbeans power user, I'm just sharing what has 
worked for me in hopes this might save you some time.  There are always 
better ways of doing things.

1.  Build a JDK to debug.  Exploded is the fastest to build/debug.

1a.  If you're in Oracle and want to use jib and closed source, 
clone/configure the current source from the closed/open repositories:

     % hg clone <closed_source_repo> jdk
     % cd jdk
     % bash ./get_source.sh         # clones corresponding open repo)
     % bash jib.sh configure -- \
           --with-default-make-target=jdk ...other options...

1b.  If you're external to Oracle, clone/configure the source from the 
open repository:

     % hg clone http://hg.openjdk.java.net/jdk/jdk jdk
     % cd jdk
     % bash configure \
           --with-default-make-target=jdk ...other options...

2.  Build the JDK:

     % cd build/linux-x64
     % make

3.  Download Apache NetBeans 12.  I use the binaries instead of the 


     % unzip netbeans-12.0-bin.zip

If you are using Windows, you'll probably still need to make the 
.exe/.dll bits executable:

     % cd netbeans
     % find . -type f -name '*.exe' -exec chmod +x {} \;
     % find . -type f -name '*.dll' -exec chmod +x {} \;

Be sure to have a recent JDK build for netbeans_jdkhome.  If NB can't 
find a JDK in your path, you can hardcode it in etc/netbeans.conf:


It is also recommended to have lots of initial memory:

     netbeans_default_options="-J-Xms2048m ..."

3.  Start NetBeans:

     % bin/netbeans           # Solaris/Linux/MacOS/etc.
     % bin/netbeans64.exe     # Windows

4.  Start to create a new Java project in order to activate the Java SE 

     File->New Project->Java with Ant->Java Application

Download/activate the nb-javac editing support library.  You don't 
actually need to finish creating the project unless desired.

5.  Navigate to and open the JDK module src directories you'll be using. 

         jdk/src/java.base   # jdk/open/src/* if using closed

The module sources for debugging the platform will be found in these 
open modules, along with the resulting built/binary files.

Note:  the first time you open a module, it may take a couple minutes to 
scan through everything (source/binary/etc).  Restarts are faster after 
things are cached.

6.  Depending on whether you'll debug a standalone app or a JTREG test 
from the test directories:

6a.  Standalone:  create a test project app as normal.  The platform 
should be set automatically from the modules you opened, but if not:

     .  Right click on project, select Properties.
     .  Choose libraries, select the platform you just created.

6b.  JTREG:  In the java.base module you opened (above), navigate to the 
jdk test tests in the following directory entry:

     ${jdkRoot}/test/jdk     # ${jdkRoot}/open/test/jdk/ if using closed

Then select the exact test you want to run, then "Debug->Debug Test File".

NOTE WELL:  The JTReg plugin understands the JTReg directives. 
Debugging a JTReg test used to trigger a remake of the entire(!) JDK. 
Turn this behavior off by right clicking on the java.base module, then 
"properties", then set "Never" to the question of "Build before running 
tests."  I *THINK* NB 12 no longer does a rebuild, but in case you don't 
and you end up with a long delay, this might be the problem.

It will take a while to scan through the test directories 
(source/binary/etc).  Restarts are faster as things are cached.

System.out/System.err will be delivered at the end of the JTREG run, so 
don't depend on any output while the program is running.

7.  Set a break point in your app(s) and start debugging using "Debug 
Project" or "Debug Test File."  You should be able to "Step In (F7)" to 
the JDK library code.

I have been successfully able to debug multi-process client/server code 
by setting breakpoints in both the client and server code, then "Debug 
Project" each project.

8.  If you make any changes (think/edit/compile) to your JDK code, I 
suggest stopping the debugger(s), then use a separate window to do the 
make.  For a simple rebuild of the Java classes in javax/net/ssl + 
sun/security/ssl, I do:

     # cwd:  build/*-normal-server-fastdebug

     % make LOG=debug \
         JDK_FILTER=javax/net/ssl,sun/security/ssl \
         java.base-java-only     # or java.base-only

Netbeans will notice any changes and reload as needed.  Then restart the 
debugging session.

9.  If you use an external editor to edit your code, the breakpoints 
might get confused.  e.g. if you have a breakpoint on line 51, and 
externally you add a line, Netbeans won't realize that the breakpoint 
should be on line 52.  If you edit within Netbeans, this doesn't happen.

I would like to make a wiki page with this info at some point, so if you 
have any comments, let me know.

Good luck,


P.S.  Jan Lahoda's "JDK Project for NetBeans" plugin, and "JTReg 
Support" is no longer required.

More information about the jdk-dev mailing list