• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic