How do I add `java` to the command path on Vista?

14,498

Solution 1

Open My Conputer -> General Settings -> Environment variables and add as global

Key:JAVA_HOME Value:C:\jsdk etc. etc.

And then modify the Path variable

Value ( type at the end )

 ....something;something;something;%JAVA_HOME%\bin

Reopen your command prompt and type

 javac 

And see if it works

EDIT

Moved my comment to the answer

The command prompt has some problems dealing with the empty space.

What I usually do is install the jdk directly on C: to get rid of space in "Program Files"

So installing it directly in C: will give you an "spaceless" path to the executable:

  C:\jdk1.6.0_14\bin\javac

Instead of

 C:\Program Files\Java\jdk1.6.0_14\bin\javac

Some times you'll get: C:\Program "executable not found" or something like that.

Installing directly on C: does the trick

Solution 2

I'd suggest looking at the java tutorial.

http://java.sun.com/docs/books/tutorial/essential/environment/paths.html

Share:
14,498
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin over 1 year

    I have JDK installed in Vista. I want to run java from the command line. How do I configure the path variable?

    If I'm not able to set the JAVA_HOME variable, what is an alternative?