sazzad
sazzad

Reputation: 6267

Enable Compile on Save option in Netbeans 11

How can I enable Compile on Save in Apache Netbeans IDE 11.0?

https://i.sstatic.net/OOYQE.png

Output of my java -version

java version "11.0.4" 2019-07-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.4+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.4+10-LTS, mixed mode)

I tried setting:

and possible combinations of these. But not to succeed so far.

Upvotes: 4

Views: 7328

Answers (2)

skomisa
skomisa

Reputation: 17391

TLDR:

  • You need to install the nb-javac library to enable compile on save.
  • However, due to a NetBeans bug, you must use version 11.2 beta 3 of NetBeans for that to work.

You may be seeing this issue because you need to install the nb-javac library. To determine whether installation is necessary:

  • Open the Notifications window by selecting Window > IDE Tools > Notifications.
  • If installation is required there will be a message stating "Install nb-javac Library" in the Notifications window:

    nb-javac library

To install the nb-javac library:

  • Unfortunately you must use version 11.2 beta 3 (or later) of NetBeans. This is due to an unrelated problem with the installation of nb-javac.
  • You can download NetBeans 11.2 beta 3 from this page. The file is named netbeans-11.2-beta3-bin.zip. Just download the zip file, then unzip it in a new directory.
  • From version 11.2 beta 3 of NetBeans (or later), select the notification in the Notifications window.
  • Click the link in the right pane with the text "It is recommended to install nb-javac Library to improve Java editing experience and enable compile on save".
  • A wizard for installing the library will be shown:

    Wizard

  • Complete the steps in the wizard. Once installation is complete, restart NetBeans.

After restarting NetBeans you should find that:

  • The nb-javac library has been installed.
  • The Compile on Save checkbox for your project is enabled.

I could reproduce your problem in NetBeans 11.1, and I have verified that this solution worked for me.

Notes:

Upvotes: 6

Joachim Rohde
Joachim Rohde

Reputation: 6045

The nbjavac plugin needs to be installed. See also here.

Upvotes: 1

Related Questions