I have an application that runs as both a desktop application and a server application. When I run as a server and take a heap dump of my application, I still see a few desktop-related classes getting loaded (but all have zero instances):
java.awt.image.RenderedImage
java.awt.Image source
java.awt.image.WritableRenderedImage
java.awt.Transparency
java.awt.image.BufferedImage
java.awt.image.ImageObserver
java.awt.MenuContainer
java.awt.Component
java.awt.Graphics
java.awt.Graphics2D
I think in server mode I don't reference any GUI related classes - i.e. my main class makes the server/desktop determination and then uses reflection to either instantiate a server class or GUI-containing class. My GUI is Swing-based, and no swing-related classes show up in the heap dump, so I'm "nearly" certain that the above references aren't from any of my code. That leaves the third-party libraries as the possible culprit (or I simply overlooked something).
Either way, how do I determine who is causing these classes to load?