Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Query Packages

 
Kartik Mahadevan
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hii

Normally when we import some classes it is required that the files may be present in the next directory ie :- When we import some A.B class then A directory should be present in the current working directory and B class should be present inside it but when we include Java.(anyclass) and java is not present in our current working directory it still compiles .Is it something special with java packages.

Thanks
With Regards
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any classes in JARs or directories on the classpath will be available. As well, the JVM is set up to load a set of java.* (and sun.* or any JVM-specific packages) automatically. For Sun's JRE I think this is still rt.jar and possibly others.

The compiler uses this same mechanism.
 
Mehul Sanghvi
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Karitk,

While compiling/executing java applications using javac/java you need to set the Java-Home variable.
These utilities in turn maps their classpath to include JAVA_HOME/jre/lib.rt.jar which has the java class files.

Regards,
Mehul.
 
Kartik Mahadevan
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank U very much
 
Kartik Mahadevan
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir

How do U people get such intricate information which is not present in books like complete refrence ? Please let me know.

Thanks
Regards
M.Kartik
 
Mehul Sanghvi
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Practice!
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kartik Mahadevan:
How do U people get such intricate information which is not present in books like complete refrence ?
In this particular case, you used to have to put the java.* classes JAR into the classpath yourself. Then one day (I don't remember which JDK release it was) it was no longer necessary so this one stands out.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic