Tuesday 15 September 2015

Refresh rt.jar Concepts


Runtime JAR (rt.jar) and contains the bootstrap classes (core Java API).
PATH Where rt.jar exists: \Java\jdk1.6.0_38\jre\lib\rt.jar


For Windows/Linux: rt.jar
For MacOSX: classes.jar, prior to JDK 7. From Java 7 Apple has stopped distributing Java and if you separately install, it will have same name as rt.jar.


It contains class files which is trusted by JVM and loaded without stringent security check it does for other class files.


Important points about rt.jar

1)rt.jar must be included in project classpath, otherwise core library (like java.lang.String, java.lang.Thread, java.util.ArrayList or java.io.InputStream and other classes) will not accessible from Java APIs. It contains all Java API along with internal classes specified in com package.

2)In windows, rt.jar will always reside under $JAVA_HOME/jre/lib, where $JAVA_HOME refers to JDK installation directory.

3)Only If JDK is installed (not JRE) then sources(rt.jar) will find inside $JAVA_HOME/ src.zip file.

4)All the classes in rt.jar is known to JVM, which means JVM doesn't check it while loading any other JAR from any other location.
To overcome the  performance issues, these classes are loaded by bootstrap or primordial class loaders including external class files in rt.jar.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...