Configuring the Java Development Kit (JDK) Windows 10

In my previous tutorial, Installing the Java Development Kit (JDK) on Windows 10, I demonstrated the simple process of installing the JDK. Now we need to configure the Windows 10 environment variable to recognize the location of the javac compiler and the java JVM.



From the command prompt, type in javac and then press Enter. You should see an error 'javac' is not recognized as an internal or external command, operable program or batch file. This is because the %PATH% system variable does not contain the directory for the javac.exe compiler.
We will need to locate the Java compiler executable(javac.exe).

Type in cd \ then press Enter.
Type in dir javac.exe /s the press Enter.
It may take a minute depending on the speed and size of your hard drive, but once it finds the file, you'll now know the directory that javac.exe is located in.

The first thing that we will do is type in "envir" into the Windows 10 search area. We should see "Edit the System Environment Variables" appear, select that.

Click the Environment Variables button.

Highlight the Path variable in the System Variables section and press Edit.

Click New then Browse.

Browse to the location of the javac.exe program that we searched for in the command prompt above. Select OK.

You should see the new entry, click OK and close any other windows by clicking OK as well.

Open the command prompt back up by going to Start, Search or Run (depending on which version of windows you are running), and type in CMD.exe then Enter.
Type in cd \ then Enter.
Type in javac then Enter.
If you see a list of a whole bunch of javac options, then congratulations on successfully installing the JDK and setting the necessary file paths!


Tutorials