How to Install Java JDK and Set the Environment Variables

Get the Computer Ready for Java Programming

Cloudage
In this article we will cover how to install Java JDK on Windows XP, and how to set the environmental variables. If you are new to programming with JAVA, you must do this before you are able to run your programs. Basically all you do is to include references to java on your machine.

The first thing is to get the software. Go to www.sun.com, and search for Java JDK in the download section. Always try to get the most current version, as of now that is 1.6. This software is free, so download it to your computer. During installation it's fine to go with the custom options, so click next until the installation finishes.

Java should now be installed under c:program filesjava. Go to My Computer and find the folder under program files. Inside the java folder there should be another folder called JDK. Write down the numbers after JDK to get the current version that you have. In my example this is jdk1.6.0_07.

Now it's time to set the environmental variables, and after that you should be ready to go.

Open up My Computer. Right click on the background (not any icons!) in the folder, and choose properties. Find the advanced tab on the top right, and finally the environment variables on the bottom left.

This is where we have to add the references to java, and as you should see there are two places to add it; user and system. User is just for your account on the computer, while system adds it for everyone who uses the machine. It's best to put it under system.

Scroll down on the list until you find the path variable. This is where we will put in the path to java, so don't change anything but hit "end" on your keyboard to go to the far right. Hit the semi colon to separate from the previous path and then write the new path, and put in at the end. Mine would be ;c:program filesjavajdk1.6.0_07in.

Click OK to close it, and than open up command prompt. You should now be ready to issue javac commands to compile your source files. If you get any error message saying that javac is not recognized as an internal or external command, you need to double check your path, and include the CLASSPATH variable.

To get the CLASSPATH you do as you did on the path, but instead of going to "path", you go to "CLASSPATH". If there is no CLASSPATH, you add it under system. The path here is c:program filesjavajdk1.6.0_07lib
ools.jar. (The version number depends on which one you have).

If it still doesn't work for you, read the instructions over and try again. Then your computer is set up for Java programming!

Published by Cloudage

I am a student studying and tutoring in math, chemistry and physics.  View profile

  • Set the environment paths correctly to avoid headache.
  • Java Sun has free software.
  • Downloading java jdk is free.
Java programming is fun and challenging, but the computer must have references to where the kit is located.

1 Comments

Post a Comment
  • amin10/8/2010

    thank you.. nice post

To comment, please sign in to your Yahoo! account, or sign up for a new account.