Skip to content

NetBeans

Build Apache NetBeans from source, clear the Recent Projects list and choose the JDK the IDE runs on.

2 min readUpdated

Apache NetBeans is an open-source IDE for Java and other languages, built with Apache Ant. This note builds it from the Git repository, and covers two settings that are not in the options dialog: the Recent Projects list and the JDK the IDE itself runs on.

Build and run from source

The build needs Git, Apache Ant and a JDK. Current NetBeans sources require JDK 21 or later.

  1. Install the JDK and Ant, and point JAVA_HOME at the JDK (or leave JAVA_HOME and ANT_HOME unset).

  2. Clone the repository:

    Terminal window
    git clone https://github.com/apache/netbeans.git
    cd netbeans
  3. Build the default release configuration. This compiles the IDE and assembles the NetBeans Platform:

    Terminal window
    ant build

    Plain ant runs the default target, build-nozip, which builds the same IDE without packing the ZIP distribution. To build less, choose a smaller cluster configuration, for example ant -Dcluster.config=basic build for mainly the Java features.

  4. Start the IDE you just built:

    Terminal window
    ./nbbuild/netbeans/bin/netbeans

    ant tryme does a quick test run instead.

If a build fails:

  • Check that JAVA_HOME points to a supported JDK.
  • Remove cached build output and start again. The README recommends git clean -Xdf, which deletes every file ignored by Git; ant clean is the lighter option.
  • The nbbuild directory contains most of the build scripts and configuration, and the portable ZIP distribution after a successful build.

Remove projects from the Recent Projects list

The Start Page and File > Open Recent Project read their list from projectui.properties in the NetBeans user directory. On macOS the file is here:

~/Library/Application Support/NetBeans/<netbeans-version>/config/Preferences/org/netbeans/modules/projectui.properties

Close NetBeans, then remove the entries of the projects you no longer want from the file, or delete the file to clear the list. Help > About shows the user directory on other systems.

Set the JDK NetBeans runs on

The JDK that runs the IDE is set by netbeans_jdkhome in netbeans.conf, in the etc directory of the installation. On macOS:

/Applications/Apache NetBeans.app/Contents/Resources/netbeans/etc/netbeans.conf

Change the line so that it points at your Java installation. Editing the file may need administrator rights. This example uses the Homebrew OpenJDK on an Intel Mac; on Apple silicon Homebrew lives in /opt/homebrew instead of /usr/local:

netbeans_jdkhome="/usr/local/opt/openjdk/libexec/openjdk.jdk/Contents/Home"

To try a JDK for one session without editing the file, start the launcher with --jdkhome:

Terminal window
netbeans --jdkhome /path/to/jdk

This JDK is also the default JDK for new projects. Projects can use other JDKs, added in Tools > Java Platforms.

References

Related notes

2 min read

ngrok

Expose a local web server on a public HTTPS address with ngrok, for webhook testing, demos and testing on real devices.

  • Developer Tools
3 min read

Vim and Neovim

Set up Vim with VimTeX and Zathura for LaTeX on macOS, and add the Neo-tree file explorer to Neovim.

  • Developer Tools
3 min read

SonarQube

Run SonarQube locally in Docker and analyse a Maven project with the SonarScanner for Maven.

  • Observability & Testing
  • Developer Tools

Type to search the whole site.