Question about java.system.class.loader and the module system

Alan Bateman Alan.Bateman at oracle.com
Mon Mar 8 13:44:11 UTC 2021


On 03/03/2021 20:12, Volker Simonis wrote:
> :
> Maybe I should have been more specific. I meant that the paragraph on
> "java.system.class.loader" should contain one more sentence mentioning
> that setting it will only have the desired effects for the loading of
> application classes for non-modularized applications.
>

"... and is typically the class loader used to start the application" is 
correct is that it will almost always be the defining class loader of 
the main class, even if it is loaded from a named module.

The combination of -m and -Djava.system.class.loader= should be rare. If 
there is a compelling need then we could add another sentence to the 
@implNote to document that the java launcher uses the system class 
loader when loading the main class from the class path, it is not used 
when -m is specified.

-Alan


More information about the core-libs-dev mailing list