Monday, 25 April 2016

What is the importance of rt.jar ?


Runtime JAR (rt.jar) contains the core Java API (bootstrap classes)
It exists at location : JAVA_HOME\jre\lib\rt.jar



IMPORTANT POINTS
1) rt.jar must be included in project classpath, otherwise Core library classes like,  java.lang.String, java.lang.Thread, java.util.ArrayList, java.io.InputStream etc. will not accessible in your Java program.

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

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

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

Note: only a member of this blog may post a comment.