Table of Contents

Installing OpenJDK and Apache NetBeans on Windows 10

The following has been vetted for AdoptOpenJDK's OpenJDK 11 (LTS) and Apache NetBeans version 12 (LTS).

Introduction

This guide takes you through the process of installing OpenJDK and Apache NetBeans for Java development on Windows 10. To install OpenJDK, we will be using resources created by the AdoptOpenJDK project. AdoptOpenJDK greatly simplifies the process of installing OpenJDK for the typical user.

Be sure to install things in the order listed.

Install OpenJDK

  1. Go to the AdoptOpenJDK homepage and select the Version you want to install. I recommend you get the newest LTS release, which at this time is OpenJDK 11. Also select the JVM you want. I use the HotSpot JVM. I have no experience with OpenJ9.
  2. Click the Latest release button and save the installer someplace on your computer.
  3. Start the installer, accept the licenses, and make sure the installation options are set as given below:
    • Add to PATH: ON
    • Associate .jar: ON
    • Set JAVA_HOME variable: ON (the default if OFF)
    • JavaSoft (Oracle) registry keys: OFF
  4. Install the package.

Installation verification

If you wish, you can verify that the installation was successful by doing the following:

  1. Open a command line prompt 1) and enter java -version. You should see something along the lines of:
    openjdk version “11.<version>” 2020-04-14
    OpenJDK Runtime Environment AdoptOpenJDK (build 11.<version>)
    OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.<version>, mixed mode)
  2. In the same window, enter javac -version (note the 'c' at the end of the command). You should see something along the lines of:
    javac 11.<version>

If you know how to check the system PATH and environment variables, you can additionally do the following:

Install Cygwin

If you want a functioning terminal in NetBeans (and you almost certainly do), you will need to install a basic Cygwin environment. Download setup-x86_64.exe from https://cygwin.com/install.html, start the installer and walk through the wizard as follows:

  1. Install from Internet.
  2. Install into the default location (C:\cygwin64) for All Users.
  3. Set the Local Package Directory to something that makes sense (consider a system-wide location, e.g., C:\cygwin64-local-packages).
  4. Set the Internet connection to “Use System Proxy Settings” (unless you have reason to use something else).
  5. Select a download mirror that’s close to you.
  6. Don’t select any packages to install, just hit Next. (We only need the base installation.)
  7. Review and confirm.
  8. Select “Add icon to start menu”. You probably don't want a desktop icon.

Install Apache NetBeans

  1. Go to https://netbeans.org/downloads/ and click Download for the latest release.
  2. On the resulting page, under Installers, click on
    Apache-NetBeans-<version>-bin-windows-x64.exe
    On the following page, select a mirror from which to download. Save the installer to your computer.
  3. Run the installer and walk through the steps of the wizard:
    • The installer gives you the option to customize the features you want. If you are short on storage space and will only be doing Java development outside an enterprise environment, the only options you will need are Base IDE, Java SE, and HTML5/JavaScript.
    • Accept the license.
    • Verify that the “JDK for Apache NetBeans IDE” is set to
      C:\Program Files\AdoptOpenJDK\jdk-<version>-hotspot
    • Allow the installer to check for updates.
    • Finish

First time run

The first time you create a Java project, you will probably be prompted to add nb-javac Java editing support library and JavaFX Implementation for Windows. Enable both checkmarks and click Download and Activate …, accept the licenses and install.

1)
To open a command line prompt, press the Windows key, type cmd in the search bar, and select the Commandline Prompt app.