File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes SCJP 6 K&B Study Guide Chap 10 Ques 11? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "SCJP 6 K&B Study Guide Chap 10 Ques 11?" Watch "SCJP 6 K&B Study Guide Chap 10 Ques 11?" New topic
Author

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

rich dubois
Greenhorn

Joined: Feb 16, 2010
Posts: 20
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
Ireneusz Kordal
Ranch Hand

Joined: Jun 21, 2008
Posts: 423
you will find explanation how classpath works here: http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
rich dubois
Greenhorn

Joined: Feb 16, 2010
Posts: 20
Thanks for the help and the links!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SCJP 6 K&B Study Guide Chap 10 Ques 11?
 
Similar Threads
struts
Modifying existing jar file, how?
"You must include the name of the JAR file at the end of the path"?
Practice Exam Question - Will this really compile?
Confusion over java classpath