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.
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.
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.
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.
And when my army is complete, I will rule the world! But, for now, I'm going to be happy with this tiny ad: