aspose file tools*
The moose likes Beginning Java and the fly likes Query Packages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Query Packages" Watch "Query Packages" New topic
Author

Query Packages

Kartik Mahadevan
Ranch Hand

Joined: Feb 16, 2005
Posts: 47
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

Joined: Aug 07, 2003
Posts: 1646
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

Joined: Feb 04, 2002
Posts: 134
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

Joined: Feb 16, 2005
Posts: 47
Thank U very much
Kartik Mahadevan
Ranch Hand

Joined: Feb 16, 2005
Posts: 47
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

Joined: Feb 04, 2002
Posts: 134
Practice!
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Query Packages