How do I add Java to my Windows PATH?

Do you have the latest version of the Java Platform, Standard Edition Development Kit installed?
No. Get it here.

If you did download Java you should see a folder like this (assuming the default install and whatever the current version of Java SDK is):

(so the image above is showing you that Java is on my computer (on my C drive in Program Files and in the Java folder))

Now open your command prompt and type this: java -version
Then press the ‘Enter‘ key.

If you don’t see something like this than you didn’t set your Windows Environment path to know about your Java install:

So if you are still reading, this means you need to change set your PATH Environment path.

The short version is do this:
Windows 7 OS
(To make sure that Windows can find the Java compiler and interpreter)

  1. Select Start -> Computer -> System Properties -> Advanced system settings -> Environment Variables -> System variables -> PATH.
  2. Prepend C:\Program Files\Java\jdk1.6.0_27\bin;to the beginning of the PATH variable.
    • your version of the jdk may be different. If it is, change it to the name you have
    • don’t forget that semi-colon(;) at the end (this is the separator character used between all the URLs in the path
  3. Click OK three times.
[For previous Window OS’]

[ In Vista, select Start -> My Computer -> Properties -> Advanced -> Environment Variables -> System variables -> PATH. ]
[ In Windows XP, Select Start -> Control Panel -> System -> Advanced -> Environment Variables -> System variables -> PATH. ]

If you need some pics for reference, here you go:

To add or edit anything environment variables in your Windows 7 you need to first go to System properties

Go to “Advanced system settings”

Go under “Advanced” tab > “Environment Variables …”

Go to PATH > double click and add new path into the “variable value” make sure you separate the value with “ ;

Click ‘OK’ three times.

Now open your command prompt and type this: java -version
Then press the ‘Enter‘ key.

You should now see this:

  • if you do, congrats! you have successfully added java to your path
  • if you don’t, try following the directions again and see if you made a mistake somewhere along the way

 Note: If you are running Windows 7 and you want to change the Environment Variables via the Command Line (CLI), Just open  Windows Power Shell and follow the info on this link.

3 Replies to “How do I add Java to my Windows PATH?”

Leave a Reply

Your email address will not be published. Required fields are marked *