Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
rich dubois
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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
 
Ireneusz Kordal
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • 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
 
Ankit Garg
Sheriff
Posts: 9509
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks for the help and the links!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic