Search code examples
javaclassjvmclassloadernative

Why doesn't java's -verbose:class argument include jre inherent native classes?


When I use the VM argument "-verbose:class", it shows all classes that are being loaded except for those that are both inherent to java and declared natively, like primitives or arrays (can't think of anything else though, are there?).

Despite using the following line of code within a main method, you don't see this type being loaded according to the verbose output

int[] o = new int[0];

Is there a way to make this possible through other means?


Solution

  • These clasess are pre-loaded using an optimized code path which circumvents almost all the standard classloading mechanisms and verifications. That's why you don't see them. Basically, one cannot distinguish the loading of such a class as a separate event; they are loaded in bulk from a pre-cached image.