If you want to setup the Java SDK on your computer, you’ll have to have the environment variable for the location of the SDK set in Windows. The variable is commonly called the classpath.
Here are the instructions to setup your classpath for your brand new Java SDK for both Windows XP and Vista.
Windows XP Instructions
Windows XP is the least annoying to setup, of course, there are no popups asking yes or no?
- Find your newest SDK directory. Navigate to C:\Program Files\Java
Find the first folder which starts with jdk. Now, if there is more than one, open the largest one. (If there are choices, jdk1.6.0_07 and jdk1.6.0_10, choose the one with _10.) - Inside of that folder, open the bin directory. Copy the file path to this directory. (You can enable the address bar in Windows XP by going to View>Toolbars>Address Bar. You may need to unlock the bars via right-click and reposition the address bar.) Paste the file path into notepad for safe keeping.
- Go to the start menu.
- Locate My Computer.
- Right click on it.
- Click on Properties. It’s probably at the end.
- Choose the advanced tab from the group of tabs of the new window.
- Locate on Environment Variables and click on it.
- The first box has variables for the current user account. Click new. Enter PATH. Then in the value box, paste the file path to the directory you copied earlier.
- The second box is for the System. Locate PATH or Path and once selected, click edit. In the value, there might be something already. Don’t delete that stuff. Add a ; to the end of your file path you copied earlier and then add it and the path to the front of the entire list of things in the value box. Click okay.
- Then click okay again.
- Click okay again. Log out of your user account or restart. You’ll be able to use javac now.
Windows Vista Instructions
The instructions for Vista aren’t that different than XP.
- Find your newest SDK directory. Navigate to C:\Program Files\Java
Find the first folder which starts with jdk. Now, if there is more than one, open the largest one. (If there are choices, jdk1.6.0_07 and jdk1.6.0_10, choose the one with _10.) - Inside of that folder, open the bin directory. Copy the file path to this directory
- Go to the start menu.
- Locate Computer.
- Right click on it.
- Click on Properties. It’s probably at the end.
- A new window will appear at this point telling you about your Computer. On the side bar, the last item should be Advanced Settings. Click on that.
- The new window should have a number of tabs. Look for Advanced and click on it.
- Locate Environment Variables and click on it.
- The first box has variables for the current user account. Click new. Enter PATH. Then in the value box, paste the file path to the directory you copied earlier.
- The second box is for the System. Locate PATH or Path and once selected, click edit. In the value, there might be something already. Don’t delete that stuff. Add a ; to the end of your file path you copied earlier and then add it and the path to the front of the entire list of things in the value box. Click okay.
- Then click okay again.
- Click okay again. Log out of your user account or restart. You’ll be able to use javac now.
I don’t know any other case of Environment Variable modification other than changing them for the Java JDK.
I have set the PATH but my computer (with VISTA) compiles (javac) programs but returns class loader errors when I trun to run (java) the program. It has been suggested that my classpath is not properly set.
Can you help ?
You might not have the JRE classpath set up right.
In your CLASSPATH environment variable, the path to the JRE (Java Runtime Engine, I think?) should be something like this
C:\Program Files\Java\jre6\lib\ext\QTJava.zip
I’m not actually sure what the difference between the PATH and CLASSPATH EV’s are. I ussually add both the JDK and the JRE paths into both just to make sure. Could you post one of the errors you get?