File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes setting the class path on win NT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "setting the class path on win NT" Watch "setting the class path on win NT" New topic

setting the class path on win NT

Mike Pirrone
Ranch Hand

Joined: Oct 30, 2001
Posts: 33
whats up guys? I've been in this java class in college for about 7 weeks now and our lab is still not compiling or running any java code. I tried setting the classpath as I did at home (win xp) and i still cannot get anything to compile. so i was wanting to know how to get this thing going on NT. any links? thanks
Mike Pirrone
Ranch Hand

Joined: Oct 30, 2001
Posts: 33
oops.. its win 2000
Rob Ross

Joined: Jan 07, 2002
Posts: 2205
First, are the JDK binaries in your PATH? Ie, can you type
java -version

at a command prompt and get a response or does it report it's an unknown command?
Second, what exactly are you trying to compile? One file? One package? Or a complex source tree with many classes, packages, and libraries?
If you're just doing entry-level stuff, you can get by with just providing the classpath as a parameter to the javac and java commands.
For real-world applications, I don't use the CLASSPATH environment variable because it's too limiting. Instead, I will create batch files that set the classpath depending on what I'm trying to do.
If you have a single java source file like

public class HiDude{
public static void main(String[] args)
System.out.println("Hi dude");
to compile this:
1) CD in the command console to the directory where is.
2) type javac -classpath "./"
That will compile it.
To run it, type
java -classpath "./" HiDude.
Good luck!

SCJP 1.4
Tetsuo Suzuki

Joined: Feb 21, 2002
Posts: 22
Right click on My Computer --> Click on Advanced --> Set Environment Variables. Funny enough, if you use a batch file, it doesn't keep the EVs once you close the console window. Also, you may have to close and re-open the console window in order to have your Environment Variables applied. The easiest way, d00d, to make it work is to download TEXTPAD and just use it to compile. I've never gotten my CLASSPATH issues all straightened out, especially since I use multiple pieces of software (JBUILDER/TOMCAT etc.. ).
jQuery in Action, 3rd edition
subject: setting the class path on win NT
jQuery in Action, 3rd edition