This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How do I set Classpath in NT 4.0 SP 4/5  ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How do I set Classpath in NT 4.0 SP 4/5  ? " Watch "How do I set Classpath in NT 4.0 SP 4/5  ? " New topic
Author

How do I set Classpath in NT 4.0 SP 4/5 ?

erich brant
Ranch Hand

Joined: Sep 27, 2000
Posts: 246
How do I set Classpath in NT 4.0 SP 4/5 ?
How much difference is the classpath in NT to 98 or WIN2K ?


http://
erich brant
Ranch Hand

Joined: Sep 27, 2000
Posts: 246

I typed both in and still error:
Exception in thread main java.lang.noclassdeffound
CLASSPATH=;c:\jdk1.3\bin
CLASSPATH=.;C:\jdk1.3\bin
Guy Reynolds
Ranch Hand

Joined: Oct 27, 2000
Posts: 61
There are 3 ways to set the classpath variable in WinNT/2000.
1 - Windows enviroment. In winnt it's control panel --> System --> Environment --> User variables, enter classpath in the Variable field and the value you want in the Value field. Win2k is similar but it is right-click on MyComputer --> Properties --> Advanced --> Environment Variables --> new. These settings will be passed to every command shell opened, in other words they are "permanent".
2 - Command shell. Type set classpath = value you want. These settings persist for the lifetime of the command shell. Note: %classpath% echo's the current setting. So
set classpath = %classpath%;newstuff
will append newstuff to the classpath.
3 - Command line. Include classpath as an argument to the utility you are employing.
Ex
java -classpath C:\jdk1.3 MyClass
These setting apply only to the current command and persist only as long as the command is running.
note:
seperate entries with ;
Ex
entry1;entry2
. refers to the current directory
Ex
entry1;.
The java utility, by default, uses the current directory setting ( . ), but if you specify your own classpath the default "." will be replaced with the classpath you specified, so you need to be sure "." is a part of the classpath you supply.
You shouldn't need to include the jdk1.3\bin directory in your classpath. So if all the files your program utilizes are either in the current directory or in jdk1.3\bin, you don't need to specify a classpath at all. Just navigate to the directory the intended file is in and invoke
java TheClassYouWantToRun
Of course you will need to specify a classpath when you try to compile.


[This message has been edited by Guy Reynolds (edited July 18, 2001).]
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
To set the Classpath in NT go to System Properties and click on the Envionment tab. Select the classpath property and edit in the TextField at the bottom.
It looks like you have updated your classpath to include the current directory and the bin file that Sun put their stuff in. Is YOUR class actually IN the current directory that you are sitting in. No package issue here?


"JavaRanch, where the deer and the Certified play" - David O'Meara
erich brant
Ranch Hand

Joined: Sep 27, 2000
Posts: 246
What do I type in the control panel-> system-> environment->
In variable and value what do I type in and how?

CLASSPATH=.;C:\jdk1.3\bin

OR
set classpath = %classpath%

Or
Variable: PATH C:\JDK1.3\BIN
value %classpath%\jdk1.3;%bin%

PS: I have had tons of windowns NT problems lately ( nothing to do with java) so I am gun shy at messing around with my computer.
YES: java sdk is installed in
C:\jdk1.3\bin

And I have not wrote any package code yet
Guy Reynolds
Ranch Hand

Joined: Oct 27, 2000
Posts: 61
in control panel --> System --> Environment
look in the User Variables pane.
if there is already an entry for classpath then click on it and its value will appear in the Value field. Append the path you need to add by typing ; followed by the path you want to append.
for example if the Value was
c:\whatever
then change it to( only type the stuff beginning with ; )
c:\whatever;newpath
if there is not already an entry for classpath then click in the Variable field, type classpath then click in the Value field and enter the desired classpath value.
When you open a new command shell it will have the new classpath value.

[This message has been edited by Guy Reynolds (edited July 18, 2001).]
 
jQuery in Action, 2nd edition
 
subject: How do I set Classpath in NT 4.0 SP 4/5 ?
 
Similar Threads
MS Access 97 / 2000
Error:Invalid class file format for HttpServlet class in servlet.jar
Setting Classpath/path in WindowsNT
Having a HUGE problem compiling
ConnectionPool not found