Fun Statistics About JDK 20
The Java Development Kit contains many files. Last month JDK 20 was released. Let's take a deep dive into what files the JDK contains.
Join the DZone community and get the full member experience.Join For Free
As Java developers, we all have it installed on our computer: the Java Development Kit, also known as the JDK. The first version was just a few megabytes and could be saved on a few floppy disks. Many years later, it has grown multiple times. In this article, we will deep dive into the files of the JDK and come up with statistics about them.
In this study, Temurin JDK 20 for Windows x64 has been used.
The JDK files in statistics :
- Total size: 317 MB
- Largest file: lib/module with 130 MB
- Smallest file: lib/jvm.cfg with 29 B
- 574 files
- 46,393 files when including files in compressed files
- 27,064 class files (26,992 in JDK 19)
- 15,044 java files
Let’s analyze all these numbers!
The lib/module file contains the classes of JDK compressed in an unknown format. You can use the bin/jimage tool included in the JDK to list the files or to extract them. That also means that the classes of the JDK are duplicated. There are in the lib/module file and in the jmod/*.jmod files. When I select all the jmod files, I get 77 MB, meaning that the lib/module file is less compressed that jmod.
Before JDK 9, most of the classes were in a rt.jar file. With the modularisation of the JDK, each class belong to a module which is in a separate file with the jmod extension. The largest module is java.base.
The size of the modules
26,976 class files (excluding the classes from lib/module) vs. 15,044 java files (in lib/src.zip) means that inner classes and lambdas are often used in the JDK. I found 3,641 lambdas/anonymous classes ($1, $2, …) and 8,781 inner classes.
The classes in statistics:
- The longest class name is InternalFrameTitlePaneMaximizeButtonWindowNotFocusedState located in the javax.swing.plaf.nimbus package.
- There are no public class with 2 letters, only internal ones.
- The smallest class name length in public classes are 3 letters class names: URL, URI, Map, Set to name a few.
- The largest class file is GB18030.class of the sun.nio.cs package.
- The smallest class file is Remote.class of the java.rmi package.
- 7,232 classes are less than 1 KB
- Only 291 classes are more than 50 KB and only 26 above 100 KB
- All class files have the same timestamp
In terms of code conventions, many classes in the JDK start with a lowercase or contain an underscore in their name. The most common is module-info.class.
The JDK history in statistics, based on the different JDK installed on my computer:
- The largest JDK release is JDK 9 with 500 MB
- The smallest release post JDK 8 is JDK 17 with 297 MB
- 26,671 classes in JDK 17
- 30,704 classes in JDK 11
One of the surprises of this analysis is that there are fewer classes in JDK 20 than in JDK 11. One of the reasons is the fact that Nashorn and rmic modules have been removed.
Opinions expressed by DZone contributors are their own.