Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JDK 14 doesn't have rt.jar with it. Where are bootstrap classes then?

The only jar file I could find inside JAVA-HOME/lib was a file called jrt-fs.jar which is only 105 KB in size.

So where are Runtime (bootstrap) classes then?

like image 855
Joseph_Marzbani Avatar asked Jun 11 '20 12:06

Joseph_Marzbani


People also ask

Where is Rt jar in JDK?

You can see that it not only contains all Java API but also internal classes specified in com package. 3) In windows, rt. jar will always reside under $JAVA_HOME/jre/lib, where $JAVA_HOME refers to the JDK installation directory.

What classes are in RT jar?

rt. jar contains all of the compiled class files for the base Java Runtime environment, as well as the bootstrap classes, which are the run time classes that comprise the Java platform core API.

What is RT jar file in Java?

The rt. jar is where all the java packages reside. For example, if a class file calls for the java. util package, then the JVM can look for it inside the rt. jar, thus enabling it to run correctly.

How do I update RT jar?

The best way to update the rt. jar is to install a newer version for Java. ;) If you want to add your own classes in new packages, you can add these to a jar which is in your class path. This is preferable to changing existing classes.


2 Answers

The rt.jar file was removed in Java 9, but if you need to access the classfiles in the runtime, you can do so easily through the JRT file system. See, for example, https://stackoverflow.com/a/53897006/3553087.

like image 61
Brian Goetz Avatar answered Sep 23 '22 09:09

Brian Goetz


Allow me to quote the migration guide:

Class and resource files previously stored in lib/rt.jar, lib/tools.jar, lib/dt.jar and various other internal JAR files are stored in a more efficient format in implementation-specific files in the lib directory.

like image 35
Aniket Sahrawat Avatar answered Sep 26 '22 09:09

Aniket Sahrawat