• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

setting the class path on win NT

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oops.. its win 2000
 
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.. ).
 
Look! It's Leonardo da Vinci! And he brought a tiny ad!
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic