• 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

SCJP 6 K&B Study Guide Chap 10 Ques 11?

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the book it's an involved question in(so I won't type it all)

It involves comiling and executing a class that needs a class that is in a jar file

the correct answer A:
javac -classpath MyJar.jar GetJar.jav (this makes sense, from what the book said about needing the whole name of the jar file in the -cp)
java GetJar

How is this java command working? the current directory is the directory above the jar file, but I though the whole name of the jar file was needed in the -cp, and I thought java and javac found classes in the same way.

Any assistance is greatly appreciated
Thanks!

PS the book has been a fantastic help and I will admit that I have laughed a few times (at the humor) while reading it
 
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you will find explanation how classpath works here: http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rich, welcome to javaranch.

That is an error in the answer which has been pointed out before in the forum like here. Bert is creating an errata for the book, keep your eyes on this thread to see any updates on the errata...
 
rich dubois
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the help and the links!!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic