• 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

"Java" command basic question

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic