views:

96

answers:

2

After downloading java.sun.com by Window XP, c:\program files\java\jre6 is found, but not JDK files. cmd Javac -version with error message "javac is recognized command". No idea why. Also where and what do I need to update the PATH? Many thanks, Michael Chen

+5  A: 

You have to ensure that you download the JDK and not just the JRE. The JDK is the tools you need to compile your Java programmes while the JRE is only used to run your Java programmes. Visit this page and it is the first item at the top.

Once you install the JDK you can go to the System Preferences on your machine to update the PATH statement.

If you install the JDK in the default location which should be c:\program files\java\jdk1.6. then you have to add that to your PATH statement. I would suggest adding a new variable called JAVA_HOME with the value of the path where Java is installed. And then editing the PATH statement to add this: %JAVA_HOME%\bin.

That way tools that are expecting the JAVA_HOME variable will work and your system will find the java compiler etc in the bin folder.

Vincent Ramdhanie
+1  A: 

Also where and what do I need to update the PATH?

This is under Control Panel --> System --> Advanced --> Environment Variables (a button at the bottom of the dialog)

You can edit the PATH value under that, and add JAVA_HOME there too.

Spike Williams