This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting Java Classpath in Microsoft XP OS

 
Jessica Lang
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone have a clue on how to set the Java class path in the Microsoft XP OS?
Thanks in advance....
 
Frank Carver
Sheriff
Posts: 6920
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Jessica Lang
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6920
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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....
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic