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 A Mock Exam Question about 'classpath'. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "A Mock Exam Question about Watch "A Mock Exam Question about New topic
Author

A Mock Exam Question about 'classpath'.

Moguluri Ravi Kiran
Ranch Hand

Joined: Apr 16, 2010
Posts: 62

Hello friends,

This is Kiran , once i encountered Question given below in a Mock Test for Java Fundamentals 2.
but i am not aware of the following question.


CLASSPATH=app3.jar;app1.jar;\lib\Sys.class
Given the above classpath, what is the first user defined place that the JVM will search for "com.foo.App1"?
Choice 1
app1.jar
Choice 2
\lib\Sys.class
Choice 3
app3.jar
Choice 4
%JAVA_HOME%\lib\core.jar
Choice 5
%JAVA_HOME%\lib\lib.jar

please reveal the criteria behind this. discuss the Class searchig & provide me if there are useful links ...

Thank you very much & waiting.
karthick chinnathambi
Ranch Hand

Joined: Jul 06, 2009
Posts: 196

Obviously the first user-defined space where the JVM will search for classes is app3.jar.

Remember that both java and javac commands search some coommon places like...

1) %JAVA_HOME%/bin
2) %JAVA_HOME%/jre/lib/ext etc..... in a particular order

and then it searches the user-defined class paths...


1) the one which we give using set classpath and
2) the one which we give using java and javac command flag -cp (or) -classpath

and they search those directories in the order in which you specify them..... and hence the answer app3.jar



KARTHICK.C , SCJP6-93%
(Born to Win)
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3051
    
  36

Moguluri Ravi Kiran wrote:Question given below in a Mock Test for Java Fundamentals

Please QuoteYourSources


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Moguluri Ravi Kiran
Ranch Hand

Joined: Apr 16, 2010
Posts: 62

This Qustion is from 'BRAINBENCH'.

& thanks for giving right way...
 
 
subject: A Mock Exam Question about 'classpath'.