Is there any way to find the name of the main class used to launch the current JVM, from arbitrary code running in that JVM?
By arbitrary, I mean that the code is not necessarily running in the main thread, or may be running in the main thread before main has even been called (e.g., code in a user-supplied java.system.classloader, which runs before main since it's used to load main) - so examining the call stack is not possible.