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: https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=jdk-6u22-oth-JPR@CDS-CDS_Developer (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:

;C:\progra~1\Java\jdk1.6.0_22\bin

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

;C:\progra~2\Java\jdk1.6.0_22\bin 

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.