'How can I get the Minecraft class loader?

I'm loading an agent to Minecraft JVM and when I get all the loaded classes from the instrumentation, most of them are not there. My code looks like

Class.forName("net.minecraft.client.Minecraft");

and I get a ClassNotFoundException. I think it is because most of the Minecraft classes are loaded in a different ClassLoader. Any idea of how can I get this ClassLoader?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source