====== 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 [[https://openjdk.java.net/|OpenJDK]] and [[https://netbeans.apache.org/ | Apache NetBeans]] for Java development on Windows 10. To install OpenJDK, we will be using resources created by the [[https://adoptopenjdk.net/|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 =====
- Go to the [[https://adoptopenjdk.net/|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.
- Click the //Latest release// button and save the installer someplace on your computer.
- 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//
- Install the package.
==== Installation verification ====
If you wish, you can verify that the installation was successful by doing the following:
- Open a command line prompt ((To open a command line prompt, press the Windows key, type ''cmd'' in the search bar, and select the Commandline Prompt app.)) and enter ''java -version''. You should see something along the lines of:\\ **openjdk version "11." 2020-04-14\\ OpenJDK Runtime Environment AdoptOpenJDK (build 11.)\\ OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11., mixed mode)**
- 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.**
If you know how to check the system PATH and environment variables, you can additionally do the following:
* Verify that \\ ''C:\Program Files\AdoptOpenJDK\jdk--hotspot\bin''\\ is on the system PATH in front of any Oracle Java entries.
* Verify that the system JAVA_HOME variable is set to\\ ''C:\Program Files\AdoptOpenJDK\jdk--hotspot\bin''
===== 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:
- Install from Internet.
- Install into the default location (C:\cygwin64) for All Users.
- Set the Local Package Directory to something that makes sense (consider a system-wide location, e.g., ''C:\cygwin64-local-packages'').
- Set the Internet connection to "Use System Proxy Settings" (unless you have reason to use something else).
- Select a download mirror that’s close to you.
- Don’t select any packages to install, just hit Next. (We only need the base installation.)
- Review and confirm.
- Select "Add icon to start menu". You probably don't want a desktop icon.
===== Install Apache NetBeans =====
- Go to https://netbeans.org/downloads/ and click Download for the latest release.
- On the resulting page, under Installers, click on\\ ''Apache-NetBeans--bin-windows-x64.exe''\\ On the following page, select a mirror from which to download. Save the installer to your computer.
- 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--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.