How to list the classes loaded into JVM

Java 9 and above

If you are using Java 9 or above, use the below VM Option to list the classes loaded into JVM.

-Xlog:class+load=info:C:\Users\jsession4d\loadedClasses.txt

-Xlog was introduced in Java 9 to enable detailed logging in the JVM. class+load are log tags. With this JVM option the loaded classes will be written to the loadedClasses.txt file. The list of available log tags can be viewed using the VM option: java -Xlog:help .

[1.191s][info][class,load] sun.util.resources.cldr.TimeZoneNames_en source: jrt:/java.base
[1.192s][info][class,load] java.util.LinkedHashMap$LinkedKeySet source: jrt:/java.base

Java 8 and below

If you are using Java 8 and below use below JVM option to print the classes to the console.

-verbose:class

This VM option prints the classes loaded to the console.

[0.145s][info][class,load] java.io.Reader source: jrt:/java.base
[0.145s][info][class,load] java.io.InputStreamReader source: jrt:/java.base