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

Question #12 - Chapter 10 - Book Kathy Sierra SCJP

 
Ranch Hand
Posts: 336
Firefox Browser Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello every one,

i dont undestand the answer given on the book about that question, exactly: when say :

...
java needs a classpath that specifies two directories,
one for the class file (. directory), and
one for the JAR file (the com directory).
...


I dont undestastand why we de fits directory (.) for what?

PD. The example i can not test on my computer, i am over windows, and i dont know how separe paths in the classpath, because the simbol ; (semicolon) throws diferent errors when I try to use it!

Thank you.
[ March 11, 2008: Message edited by: Milton Ochoa ]
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have the K&B book with me so I can't refer to chapter 10.

If you have '.' in your classpath it means the current directory that you're in. If for example you have a java class named Test.class in c:\prog and it references a jar file (lib.jar) in c:\jarfiles you'd want to use a classpath like:

set classpath=c:/jarfiles/lib.jar;.

assuming you are in c:\prog you should be able to run your class with

java Test

alternatively you could specify the classpath in the command line:

java -cp c:\jarfiles\lib.jar;. Test
reply
    Bookmark Topic Watch Topic
  • New Topic