I am trying to list the order in which the Java class loader is loading my classes. if I use -verbose
parameter it will list every single interface/class it loads, including tons of interfaces such as Serializable, exceptions etc. Is there a way to tweak this output so it only shows which classes are loaded in the class my main method is defined?
Verbose is an option that can be used on the Java command to enable debug output for class loading. By default, this debug output is not enabled. This option can be used to determine what location the JDBC driver classes (and any/all other classes) are being loaded from.
In the Server Infrastructure section, open Java and Process Management and select Process Definition. Under Additional Properties, select Java Virtual Machine. Check the Verbose class loading checkbox. Click OK.
Load class with forName() method in Java The class object associated with the class with the given string name can be returned with the method java. lang. Class. forName(String name, boolean initialize, ClassLoader loader), using the class loader that is used to load the class.
I guess your best bet is to do the following:
main
method starts and right before it ends.There's a similar question and some answers here: Is there a way to get which classes a ClassLoader has loaded?
Did you try -verbose:class
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With