File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark ""Java" command basic question" Watch ""Java" command basic question" New topic
Author

"Java" command basic question

Graham VMead
Ranch Hand

Joined: Sep 22, 2003
Posts: 154
Just a couple of quickies
1) If I have a directory structure on a windows machine A/B/C and the java command resides in C and I don't have the CLASSPATH/PATH variable set. If I'm in the A directory can I go
B/C/java myJavaprogram ? I can't get it to work but it might be for another reason.
2) Can anyone recommend a definitive place to read up about CLASSPATH, PATH etc showing how to run/compile Java in certain scenarios?
TIA
Adrian Yan
Ranch Hand

Joined: Oct 02, 2000
Posts: 688
a) No, it won't work. java doesn't go thru subdirectory like that.
however, you can use java -classpath b/c myProgram. -classpath indicates where to look for application classes and libraries.
NOTE: if you running packages, you have to use java a.b.c.MyProgram.
b) No sure, I don't remember where, I think thru trail and error can definitely help you learn more.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch, Graham VMead!
Regarding your first question, I'm not exactly sure of what you're trying to do. If you were to post the actual commands that you are trying to execute, things might be a little bit clearer. Also, what operating system are you using?
Regarding the second question, a good place to start might be our wiki. See http://test.javaranch.com/wiki/view?HowToSetTheClasspath
Good luck and I hope to see you 'round the Ranch!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: "Java" command basic question
 
Similar Threads
Source File declaration rule in java
Class Path
javac and classpath Self Test question: why does it work?
No ClassDef found error
javac not making a .class file