blob: 99649b9a8094d78bb6fe2f7b066798c37a6fa465 [file] [log] [blame]
<!doctype html>
<html class="no-js" lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>What&#8217;s "nb-javac" in Apache NetBeans?</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Apache NetBeans blog index">
<meta name="author" content="Apache NetBeans">
<meta name="description" content="Apache NetBeans blog index">
<meta name="keywords" content="Apache NetBeans blog index">
<meta name="generator" content="Apache NetBeans">
<link rel="stylesheet" href="../../../../../_/css/font-awesome.min.css">
<link rel="alternate" type="application/atom+xml" title="Apache NetBeans Blog" href="https://netbeans.apache.org/blogs/atom" />
<link rel="stylesheet" href="../../../../../_/css/highlightjs/default.min.css">
<link rel="stylesheet" href="../../../../../_/css/netbeans.css">
<link rel="apple-touch-icon" sizes="180x180" href="../../../../../_/images/fav/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="../../../../../_/images/fav/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../../../../../_/images/fav/favicon-16x16.png">
<link rel="manifest" href="../../../../../_/images/fav/site.webmanifest">
<link rel="mask-icon" href="../../../../../_/images/fav/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#ffc40d">
<meta name="theme-color" content="#ffffff">
<link href="../../../../../_/css/font-open-sans.css" rel="stylesheet">
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
</head>
<body>
<div class="title-bar" data-responsive-toggle="responsive-menu" data-hide-for="medium">
<button type="button" data-toggle="responsive-menu"><i style='font-size: 32px; color: #fff; padding: 8px' class='fa fa-bars'></i></button>
<div class="title-bar-title">Apache NetBeans</div>
</div>
<div class="top-bar" id="responsive-menu">
<div class='top-bar-left'>
<a class='title' href="../../../../../index.html"><img src='../../../../../_/images/apache-netbeans.svg' style='padding: 8px; height: 48px;'> Apache NetBeans</a>
</div>
<div class="top-bar-right">
<ul class="vertical medium-horizontal menu" data-responsive-menu="drilldown medium-dropdown">
<li> <input id="search-input" type="text" placeholder="Search the docs"> </li>
<li> <a href="../../../../../front/main/community">Community</a> </li>
<li> <a href="../../../../../front/main/participate">Participate</a> </li>
<li> <a href="../../../../../front/main/blogs">Blog</a></li>
<li> <a href="../../../../../front/main/help">Get Help</a> </li>
<li> <a href="https://plugins.netbeans.apache.org/">Plugins</a> </li>
<li> <a href="../../../../../front/main/download">Download</a> </li>
</ul>
</div>
</div>
<!-- src/templates/news -->
<section class="hero news alternate">
<div class='grid-container'>
<div class='cell'>
<div class="annotation">Latest release</div>
<h1>Apache NetBeans 27</h1>
<p><a class="button success" href="../../../../../front/main/download/nb27">Download</a></p>
</div>
</div>
</section>
<div class='grid-container main-content'>
<article class="doc">
<h1 class="sect1">What&#8217;s "nb-javac" in Apache NetBeans?</h1>
<div class="blogdate">Sunday July 22, 2018</div>
<div class="paragraph">
<p>Not long after you start up <a href="../tentative-schedule-for-apache-netbeans/" class="xref page">Apache NetBeans (incubating) 9.0</a> <strong>on top of JDK 8</strong>, after accepting the license agreement and handling import settings, you&#8217;re confronted with this dialog:</p>
</div>
<div class="imageblock">
<div class="content">
<img src="../../../_images/blogs/entry/what-s-nb-javac-in1.png" alt="what s nb javac in1">
</div>
</div>
<div class="paragraph">
<p>What does that mean? And why, when you start up Apache NetBeans (incubating) 9.0 <strong>on top of JDK 9 or above</strong>, do you see the following, instead:</p>
</div>
<div class="imageblock">
<div class="content">
<img src="../../../_images/blogs/entry/what-s-nb-javac-in2.png" alt="what s nb javac in2">
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
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&#8217;ll have another opportunity to install it:
</td>
</tr>
</table>
</div>
<div class="imageblock">
<div class="content">
<img src="../../../_images/blogs/entry/what-s-nb-javac-in3.png" alt="what s nb javac in3">
</div>
</div>
<div class="paragraph">
<p>Let&#8217;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&#8217;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&#8217;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.</p>
</div>
<div class="paragraph">
<p>Separate from Oracle&#8217;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.</p>
</div>
<div class="paragraph">
<p>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:</p>
</div>
<div class="paragraph">
<p><a href="../../../../../wiki/main/wiki/JavacDiff/" class="xref page">JavacDiff</a></p>
</div>
<div class="paragraph">
<p>Also see this reference for details on the situation:</p>
</div>
<div class="paragraph">
<p><a href="https://cwiki.apache.org/confluence/display/NETBEANS/Overview%3A+nb-javac">https://cwiki.apache.org/confluence/display/NETBEANS/Overview%3A+nb-javac</a></p>
</div>
<div class="paragraph">
<p>However, using model APIs added in JDK 9, Apache NetBeans can make use of the Java compiler directly from the JDK, as explained here:</p>
</div>
<div class="paragraph">
<p><a href="https://cwiki.apache.org/confluence/display/NETBEANS/Java+Editor+Using+JDK+javac">https://cwiki.apache.org/confluence/display/NETBEANS/Java+Editor+Using+JDK+javac</a></p>
</div>
<div class="paragraph">
<p>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&#8217;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&#8217;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.</p>
</div>
<div class="paragraph">
<p>It&#8217;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!</p>
</div>
<section class='tools'>
<ul class="menu align-center">
<li><a title="Facebook" href="https://www.facebook.com/NetBeans"><i class="fa fa-md fa-facebook"></i></a></li>
<li><a title="Twitter" href="https://twitter.com/netbeans"><i class="fa fa-md fa-twitter"></i></a></li>
<li><a title="Github" href="https://github.com/apache/netbeans"><i class="fa fa-md fa-github"></i></a></li>
<li><a title="YouTube" href="https://www.youtube.com/user/netbeansvideos"><i class="fa fa-md fa-youtube"></i></a></li>
<li><a title="Atom Feed" href="https://netbeans.apache.org/blogs/atom"><i class="fa fa-mf fa-rss"></i></a></li>
<li><a title="Slack" href="https://tinyurl.com/netbeans-slack-signup/"><i class="fa fa-md fa-slack"></i></a></li>
<li><a title="Issues" href="https://github.com/apache/netbeans/issues"><i class="fa fa-mf fa-bug"></i></a></li>
</ul>
<ul class="menu align-center">
<li><a href="https://github.com/apache/netbeans-antora-site/edit/main/modules/ROOT/pages/blogs/entry/what-s-nb-javac-in.adoc" title="See this page in github"><i class="fa fa-md fa-edit"></i> See this page in GitHub.</a></li>
</ul>
</section>
</article>
</div>
<div class='grid-container incubator-area' style='margin-top: 64px'>
<div class='grid-x grid-padding-x'>
<div class='large-auto cell text-center'>
<a href="https://www.apache.org/">
<img style="height: 60px" title="Apache Software Foundation" src="../../../../../_/images/asf_logo_wide.svg" />
</a>
</div>
<div class='large-auto cell text-center'>
<a href="https://www.apache.org/events/current-event.html">
<img style="width:234px; height: 60px;" title="Apache Software Foundation current event" src="https://www.apache.org/events/current-event-234x60.png"/>
</a>
</div>
</div>
</div>
<footer>
<div class="grid-container">
<div class="grid-x grid-padding-x">
<div class="large-auto cell">
<h1><a href="../../../../../front/main/about">About</a></h1>
<ul>
<li><a href="../../../../../front/main/community/who">Who's Who</a></li>
<li><a href="https://www.apache.org/foundation/thanks.html">Thanks</a></li>
<li><a href="https://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
<li><a href="https://www.apache.org/security/">Security</a></li>
</ul>
</div>
<div class="large-auto cell">
<h1><a href="../../../../../front/main/community">Community</a></h1>
<ul>
<li><a href="../../../../../front/main/community/mailing-lists">Mailing lists</a></li>
<li><a href="../../../../../front/main/community/committer">Becoming a committer</a></li>
<li><a href="../../../../../front/main/community/events">NetBeans Events</a></li>
<li><a href="https://www.apache.org/events/current-event.html">Apache Events</a></li>
</ul>
</div>
<div class="large-auto cell">
<h1><a href="../../../../../front/main/participate">Participate</a></h1>
<ul>
<li><a href="../../../../../front/main/participate/submit-pr">Submitting Pull Requests</a></li>
<li><a href="../../../../../front/main/participate/report-issue">Reporting Issues</a></li>
<li><a href="../../../../../front/main/participate/#documentation">Improving the documentation</a></li>
</ul>
</div>
<div class="large-auto cell">
<h1><a href="../../../../../front/main/help">Get Help</a></h1>
<ul>
<li><a href="../../../../../front/main/help/#documentation">Documentation</a></li>
<li><a href="../../../../../wiki/main/wiki">Wiki</a></li>
<li><a href="../../../../../front/main/help/#support">Community Support</a></li>
<li><a href="../../../../../front/main/help/commercial-support">Commercial Support</a></li>
</ul>
</div>
<div class="large-auto cell">
<h1><a href="../../../../../front/main/download">Download</a></h1>
<ul>
<li><a href="../../../../../front/main/download">Releases</a></li>
<li><a href="https://plugins.netbeans.apache.org/">Plugins</a></li>
<li><a href="../../../../../front/main/download/#_daily_builds_and_building_from_source">Building from source</a></li>
<li><a href="../../../../../front/main/download/#_older_releases">Previous releases</a></li>
</ul>
</div>
</div>
</div>
</footer>
<div class='footer-disclaimer'>
<div class="footer-disclaimer-content">
<p>Copyright &copy; 2017-2025 <a href="https://www.apache.org">The Apache Software Foundation</a>.</p>
<p>Licensed under the Apache <a href="https://www.apache.org/licenses/">license</a>, version 2.0</p>
<div style='max-width: 40em; margin: 0 auto'>
<p>Apache, Apache NetBeans, NetBeans, the Apache feather logo and the Apache NetBeans logo are trademarks of <a href="https://www.apache.org">The Apache Software Foundation</a>.</p>
<p>Oracle and Java are registered trademarks of Oracle and/or its affiliates.</p>
<p>The Apache NetBeans website conforms to the <a href="https://privacy.apache.org/policies/privacy-policy-public.html">Apache Software Foundation Privacy Policy</a></p>
</div>
</div>
</div>
<script src="../../../../../_/js/vendor/lunr.js"></script>
<script src="../../../../../_/js/search-ui.js" id="search-ui-script" data-site-root-path="../../../../.." data-snippet-length="100" data-stylesheet="../../../../../_/css/search.css"></script>
<script async src="../../../../../search-index.js"></script>
<script src="../../../../../_/js/vendor/jquery.min.js"></script>
<script src="../../../../../_/js/vendor/what-input.min.js"></script>
<script src="../../../../../_/js/vendor/foundation.min.js"></script>
<script src="../../../../../_/js/vendor/jquery.colorbox-min.js"></script>
<script src="../../../../../_/js/netbeans.js"></script>
<script>
$(function(){ $(document).foundation(); });
</script>
<script src="../../../../../_/js/vendor/highlight.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', (event) => {
document.querySelectorAll('pre code').forEach((el) => {
hljs.highlightElement(el);
});
});
</script>
</body>
</html>