Downloading and Installing JDK

This page shows how to download and install the latest version of the Java Development Kit (JDK). Read the instructions carefully to set the "classpath" mentioned in Step 3. Once JDK has been installed, you can write a simple Java program using an editor such as notepad and run it from a command prompt. Alternatively, Java programs can be written using an Integrated Development Environment (IDE) such as NetBeans, described below.

1. JDK Versions

1.4. How To Set the Environment Variable JAVA_HOME

Many Java applications (such as Tomcat) require the environment variable JAVA_HOME to be set to the JDK installed directory.

To set the JAVA_HOME environment variable:

1. First, find your JDK installed directory. For JDK 11, the default is "c:\Program Files\Java\jdk-11.0.{x}", where "{x} is the update number. Use your "File Explorer" to find this directory and take note of your update number  {x}.
2. Check if JAVA_HOME is already set. Start a CMD and issue:
    set JAVA_HOME
If you get a message "Environment variable JAVA_HOME not defined", proceed to the next step.
If you get "JAVA_HOME=C:\Program Files\Java\jdk-11.0.{x}", verify that it is set correctly to your JDK directory. If not, proceed to the next step.
    3. To set the environment variable JAVA_HOME in Windows 10:
    a. Launch "Control Panel" ⇒ (Optional) "System and Security" ⇒ "System" ⇒ Click "Advanced system settings" on the left pane.
    b. Switch to "Advanced" tab ⇒ Click "Environment Variables"
    c. Under "System Variables" (the bottom pane) ⇒ Click "New" (or Look for "JAVA_HOME" and "Edit" if it is already set) ⇒ In "Variable Name", enter "JAVA_HOME " ⇒ In "Variable Value", enter your JDK installed directory you noted in Step 1. (In the latest Windows 10: you can push the "Browse Directory" button and navigate to the JDK installed directory to avoid typo error.)
    4. To verify, RE-START a CMD (restart is needed to refresh the environment variables) and issue:
      set JAVA_HOME
      JAVA_HOME=c:\Program Files\Java\jdk-11.0.{x} <== Verify that this is YOUR JDK installed directory

    Notes: Windows' environment variables (such as JAVA_HOMEPATH) are NOT case-sensitive.