Class ClasspathUrls
java.lang.Object
com.hloader.launch.ClasspathUrls
Produces a
URLClassLoader whose URLClassLoader.getURLs() reports the JVM's
actual -cp entries. LegacyClassLoaderCastTransformer calls wrap() in
place of code that does (URLClassLoader) someClass.getClassLoader() - a pattern old,
pre-1.6 Minecraft versions use (via net.minecraft.launchwrapper.Launch) to read back
the classpath, which throws a ClassCastException on Java 9+ because the real system
class loader stopped being a URLClassLoader. Setting
-Djava.system.class.loader to a URLClassLoader subclass does *not* fix this:
on modern JDKs the main class is loaded by the true built-in system loader before that
property ever takes effect, so Launch.class.getClassLoader() still returns the
non-URLClassLoader instance regardless. Patching the bytecode is the only reliable fix.-
Method Summary
-
Method Details
-
wrap
-