This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A Mock Exam Question about 'classpath'.

 
Moguluri Ravi Kiran
Ranch Hand
Posts: 63
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
Android Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4119
195
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moguluri Ravi Kiran wrote:Question given below in a Mock Test for Java Fundamentals

Please QuoteYourSources
 
Moguluri Ravi Kiran
Ranch Hand
Posts: 63
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This Qustion is from 'BRAINBENCH'.

& thanks for giving right way...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic