File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in classpath statement....

 
sunil langeh
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ans. is C
Why not others like B, E? (Got from - K&B)
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sunil.

The top level of package should be directly under classpath . ( thats wat I would always prefer) , so test directory must be in classpath to get the copilation successful as xcom is where package starts.


B and E does not include test directory in classpath !!
 
sunil langeh
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Balu Sadhasivam wrote:Sunil.

The top level of package should be directly under classpath . ( thats wat I would always prefer) , so test directory must be in classpath to get the copilation successful as xcom is where package starts.


B and E does not include test directory in classpath !!

Thanks Balu for quick reply, but it still not completely clear to me, Would you please elaborate it???
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

OK. For B.java to compile , test directory must be in classpath , wuld you agree to this atleast ? ( which means you agree that C is correct )
 
sunil langeh
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Balu Sadhasivam wrote:
OK. For B.java to compile , test directory must be in classpath , wuld you agree to this atleast ? ( which means you agree that C is correct )

Yes, but what about E
E. Set the current directory to test then invoke
javac -classpath xcom:. B.java
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because B.java is not in the test directory. Classpath is where JVM searches for class files and not java files.

So javac -classpath xcom:. B.java , would search for B.java in current directory which is test

P.s : Wish my Broadband connection is as stable as Java
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic