aspose file tools*
The moose likes Beginning Java and the fly likes Setting Java Classpath in Microsoft XP OS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Setting Java Classpath in Microsoft XP OS" Watch "Setting Java Classpath in Microsoft XP OS" New topic
Author

Setting Java Classpath in Microsoft XP OS

Jessica Lang
Ranch Hand

Joined: Jul 23, 2002
Posts: 61
Does anyone have a clue on how to set the Java class path in the Microsoft XP OS?
Thanks in advance....
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
From the start menu, open the "control panel". Select "Performance and Maintenance", then click on "System". Click on the "Advanced" tab, and at the bottom you should see a button labelled "Environment Variables".
Use the dialog which pops up when you click this button to create a new environment variable called CLASSPATH.
Remember to close and restart any command windows and running Java programs so that they pick up the new settings.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Jessica,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Jessica Lang
Ranch Hand

Joined: Jul 23, 2002
Posts: 61
After much tries-and-errors with the settings, I finally get it rite.. Below are the steps that I need to follow:
From the START menu> CONTROL PANEL> PERFORMANCE AND MAINTENANCE> SYSTEM> ADVANCED TAB> ENVIRONMENT VARIABLES> SYSTEM VARIABLES> Look for the following:
Variable Name: PATH
Variable value: %SYSTEMROOT%\system32;%SYSTEMROOT%;%SYSTEMROOT%\system32\WBEM
THEN add "C:\JDK1.3.1\BIN" to the end of Variable value, which becomes as follow:
Variable value: %SYSTEMROOT%\system32;%SYSTEMROOT%;%SYSTEMROOT%\system32\WBEM;C:\JDK1.3.1\BIN
Then exits all the previous Command.com prompt and reactivate it...and it should work fine....
A very useful Command that can be issue at the Command.com window is "PATH". This "PATH" command will show the current active path setting. In the above case, the following will be displayed:
PATH=C:\WINDOWS\SYSTEM32;C:\WINDOWS\;C:\WINDOWS\system32\WBEM;C:JDK1.3.1\BIN
Thanks Frank.....
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Aha! You actually meant the execution path (PATH), not the java class path (CLASSPATH) as you asked in your question. No wonder I answered it wrong
Glad I was of some help, anyway.
Jessica Lang
Ranch Hand

Joined: Jul 23, 2002
Posts: 61
Frank,
While doing the research, I encountered "CLASSPATH" and "PATH", as mentioned by you. Any clue on what is the difference?
Thanks again...
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
The PATH environment variable is used to search for program files (things like notepad, word, java, javac, etc.).
The CLASSPATH environment variable is used to search for classes to compile and run Java programs.
Jessica Lang
Ranch Hand

Joined: Jul 23, 2002
Posts: 61
Below is a very good reply from a dear fren (SCJP certified), which I feel may be beneficial to others too:
PATH is being used by the Windows system to locate programs to run. PATH is general, not java specific. You need PATH settings in order to run "javac" and "java" commans from anywhere on your system. CLASSPATH is use by java itself to locate java classes that may be needed for successfull compilation and/or running your java application. In most cases you do not need to set the CLASSPATH at all, because by default java uses the current directory as a classpath. You ususally use CLASSPATH if you are using 3rd party libraries of you develop your own "jar" files that you use in some other java application.
Thanks ROB....
 
Consider Paul's rocket mass heater.
 
subject: Setting Java Classpath in Microsoft XP OS