You could try to first get the bootstrap class loader by e.g. calling
ClassLoader bootstrapLoader = ClassLoader.getSystemClassLoader().getParent();
and then get the classes of this class loader as explained here: How can I list all classes loaded in a specific class loader.
But note, that getting the bootstrap class loader is not reliable, because it may not explicitly exist. So ClassLoader.getSystemClassLoader().getParent()
may return null, as explained in the Javadoc of ClassLoader#getParent():
Returns the parent class loader for delegation. Some implementations may use null to represent the bootstrap class loader. This method will return null in such implementations if this class loader's parent is the bootstrap class loader.