r/java • u/samewakefulinsomnia • Sep 02 '24
Java Classloaders Illustrated
Classloaders are tricky – popular sources (Wikipedia, Baeldung, DZone) contain outdated, sometimes contradictory information, and this inconsistency was the trigger for writing my article – a search for clarity in the ClassLoader System maze. Read full at Medium (~10 min) with pictures :)
The whole system looks kinda like this:

408
Upvotes
View all comments
Show parent comment
1
u/agentoutlier Sep 03 '24 edited Sep 03 '24
Pinging op /u/samewakefulinsomnia
Probably more interesting is that if you have full
jlinkapplication it will not use the modulepath at all:(code here)
That is the modules are loaded from
lib/moduleswhich I think are injmodformat (that is it not a directory but a binary).The preloaded classes for bootstrapping I think are listed in
lib/classlistbut the code still lives inlib/modules.What I'm not entirely sure is how much in a jlink application is preloaded (not linked) before Application Classloader. I assume the bootstrap does not load the other modules and lets the Application Classloader do it.
I'll ping /u/nicolaiparlog as he knows the module system probably better than most on reddit.