Please read our student and staff community guidance on COVID-19
Skip to main content Skip to navigation

Add Java to the Windows Path

If you want to get the "java" and "javac" commands working in the Windows command prompt then follow the steps below. These are the same for Windows XP, Vista and Windows 7. In each case you need to get to the Advanced tab in your System Properties. You can search for "environment variables" in Windows help to tell you where to locate this if you are not sure.

Before you begin download the latest Java JDK from: (make sure you choose the JDK for the correct version of Windows)

Step 1: Load the System Properties

Find My Computer Properties

Right button on the My Computer icon and select Properties from the menu.

Step 2: Find the Advanced Tab in the Properties Window

Find Advanced Tab

Click Environmental Variables

Step 3: Scroll down in the System variables and find the PATH variable

Select PATH Variable

Select the PATH variable and click the Edit button

Step 4: Add the Java installation path to the PATH variable

Add Installation Path to PATH

Add the Java installation path to the list AFTER the existing text.

In Windows XP add:


In 64-bit Windows (Windows XP 64-bit, Windows 7 (please check)) add:


When you have completed this you will need to log on and restart your computer. When you have restarted you should be able to run "java" and "javac" from the Windows command prompt.