• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 246
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do I set Classpath in NT 4.0 SP 4/5 ?
How much difference is the classpath in NT to 98 or WIN2K ?
 
erich brant
Ranch Hand
Posts: 246
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I typed both in and still error:
Exception in thread main java.lang.noclassdeffound
CLASSPATH=;c:\jdk1.3\bin
CLASSPATH=.;C:\jdk1.3\bin
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
erich brant
Ranch Hand
Posts: 246
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
reply
    Bookmark Topic Watch Topic
  • New Topic