search topic

Tuesday, November 20, 2007

Setting CLASSPATH on Windows XP

The CLASSPATH variable can be set on Windows XP with the following steps.

Click the Start button in the lower left of the screen.
Select Control Panel from the pop-up menu.
Choose System from the submenu.
Click the Advanced tab.
Click the Environment Variables button near the bottom and you will see two lists of variables.
Look in the System variables list for a variable named CLASSPATH. If you find it, click Edit. If you don't find it, click New and enter CLASSPATH in the Variable name field.
The Variable value field is a list of file paths of directories or jar files. The first thing in this list should be the current directory, which is represented in windows just as it is in Unix, as a single period. If there's more than one thing in this list, separate items with a semicolon. For example, my CLASSPATH variable starts with these three items (there are a couple more, but this should be enough to give you the idea). The only part you need is the first "dot".
.;C:\classpath\com.fredswartz.ezgui.jar;c:\classpath\TableLayout.jar;
I put extra libraries that I want to be searched in a directory named classpath, but you can choose any name.
Problems? Setting the CLASSPATH environment variable can make life much more convenient, but it can also create huge problems when testing different versions of programs that are on your classpath.

IDE. Now that I do most of my development using NetBeans, where I can specify which jar files to include, I no longer modify my CLASSPATH variable.

No comments: