Apache NetBeans (Incubating)

Sunday July 22, 2018

What's "nb-javac" in Apache NetBeans?

Not long after you start up Apache NetBeans (incubating) 9.0 on top of JDK 8, after accepting the license agreement and handling import settings, you're confronted with this dialog:

What does that mean? And why, when you start up Apache NetBeans (incubating) 9.0 on top of JDK 9 or above, do you see the following, instead:

Note: The above appears in a balloon popup in the bottom right the first time you start up Apache NetBeans (incubating) 9.0 on JDK 9 or above. If you miss out on seeing or responding to the message, go to Window | IDE Tools | Notifications anytime afterwards and you'll have another opportunity to install it:

Let's start by looking at the question, what is "nb-javac"? Well, "nb-javac", which is a patched version of "javac", i.e., the Java compiler, has long been part of NetBeans, providing a highly tuned Java compiler specifically for the Java editor in NetBeans, and wasn't part of the donation of NetBeans to Apache since, of course, the Java compiler (or a fork thereof) cannot be part of the donation. That's because Oracle is not donating Java to Apache, instead, it is donating NetBeans. The Java compiler belongs to the JDK which is licensed to Oracle.

Separate from Oracle's obvious understandable unwillingness to donate a Java compiler fork to Apache, or anyone else, Apache would have a problem with a fork of the Java compiler being distributed from Apache since the Java compiler is LGPL licensed.

In short, neither Oracle nor Apache want the Java compiler to be part of NetBeans in Apache. Yet, NetBeans gains a lot from the patched Java compiler, as explained below:


Also see this reference for details on the situation:


However, using model APIs added in JDK 9, Apache NetBeans can make use of the Java compiler directly from the JDK, as explained here:


So, as can be seen, from Apache NetBeans running on JDK 9 and onwards, you have a choice: either use the Java compiler from the JDK, which means you're not benefiting from a number of enhancements especially added for NetBeans over many years in the patched Java compiler, or you need to explicitly add the patched Java compiler, since it is provided by Oracle and its licensing is such that you need to take responsibility for installing it yourself. On the other hand, if you're using Apache NetBeans with JDK 8, the choice is simpler, i.e., you need to install nb-javac, otherwise you will not be able to use Java in Apache NetBeans.

It's not an ideal situation. On the other hand, if someone has a better solution, please feel free to propose that solution and also consider providing a pull request too!


PHP user here... Is the Java compiler something that NetBeans needs for its IDE thingies or it's just needed if you want to build Java programs?

Posted by Álvaro González on July 23, 2018 at 08:01 AM UTC #

Did you read the blog entry and the links? Your question would be answered if you did that.

Posted by Geertjan Wielenga on July 23, 2018 at 08:34 AM UTC #

The Java compiler is needed only for Java programs. But "nb-javac" isn't only for compiling Java programs, but also to help NetBeans IDE with some features the JDK 9 compiler doesn't provide for Java code.

Posted by Matheus on July 25, 2018 at 12:50 PM UTC #

Is nb-javac keeping up with JDK 10? I'd like to make use of the latest Java features but it seems nb-javac is still based on v1.8. I know this will always be a moving target. I'd just like to understand the intended development pattern for the best way to use the latest NetBeans _and_ try to use the latest Java tools. Do we develop with nb-javac and then switch to v10 in the final stages of development? That doesn't seem reasonable. Thanks.

Posted by Tony G on July 29, 2018 at 06:23 PM UTC #

Best things is always going to be to have discussions such as this on the 'dev' mailing list, i.e., go to netbeans.apache.org, where you'll find steps for joining in and having discussions, rather than doing so at the end of blog entries.

Posted by Geertjan Wielenga on July 29, 2018 at 06:49 PM UTC #

FYI, lots of work has been done on nb-javac with releases beyond JDK 8, see [1] for example, but again, please lets have this discussion on the mailing list rather than here. [1] https://gitbox.apache.org/repos/asf?p=incubator-netbeans.git;a=commit;h=9151fac31b6187c80e3cf11061d5bae67de2ec59

Posted by Geertjan Wielenga on July 29, 2018 at 06:54 PM UTC #

Post a Comment:
  • HTML Syntax: NOT allowed



Hot Blogs (today's hits)

Tag Cloud