Some sun.misc internal APIs are deprectaed in JDK 9 and will be encapsulated or removed in a future release.
ClassLoader oscl = sun.misc.Launcher.getLauncher().getClassLoader(); Field scl = ClassLoader.class.getDeclaredField("scl"); scl.setAccessible(true); scl.set(null, oscl); //reflect my real main method here, dont actually call the code because the system classloader will preload it.