Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting the class path on win NT

 
Mike Pirrone
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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-
 
Mike Pirrone
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops.. its win 2000
 
Rob Ross
Bartender
Posts: 2205
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 HiDude.java...

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 HiDude.java is.
2) type javac -classpath "./" HiDude.java
That will compile it.
To run it, type
java -classpath "./" HiDude.
Good luck!
 
Tetsuo Suzuki
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.. ).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic