Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.8] GradleForge: ClassLoader cannot be cast to class URLClassLoader


OreoNeo
 Share

Recommended Posts

Hi, i would make an Client with Minecraft and ForgeGradle in Version 1.8, but when i would start it the log say me

 

2022-04-14 20:59:32,564 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
2022-04-14 20:59:32,586 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
[20:59:33] [main/INFO] [GradleStart]: Extra: []
Exception in thread "main" java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
    at net.minecraftforge.gradle.GradleForgeHacks.searchCoremods(GradleForgeHacks.java:87)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:86)
    at GradleStart.main(GradleStart.java:26)




When i run it, Eclipse "teleport" me to GradleForgeHacks.class (i cant edit the file)
Can someone help me 😅 ?

 

for (URL url : ((URLClassLoader) GradleStartCommon.class.getClassLoader()).getURLs())
        {
            if (!url.getProtocol().startsWith("file")) // because file urls start with file://
                continue; //         this isnt a file

            File coreMod = new File(url.toURI().getPath());
            Manifest manifest = null;

            if (!coreMod.exists())
                continue;

            if (coreMod.isDirectory())
            {
                File manifestMF = new File(coreMod, "META-INF/MANIFEST.MF");
                if (manifestMF.exists())
                {
                    FileInputStream stream = new FileInputStream(manifestMF);
                    manifest = new Manifest(stream);
                    stream.close();
                }
            }
            else if (coreMod.getName().endsWith("jar")) // its a jar
            {
                JarFile jar = new JarFile(coreMod);
                manifest = jar.getManifest();
                if (atRegistrar != null && manifest != null)
                    atRegistrar.invoke(null, jar);
                jar.close();
            }

            // we got the manifest? use it.
            if (manifest != null)
            {
                String clazz = manifest.getMainAttributes().getValue(COREMOD_MF);
                if (!Strings.isNullOrEmpty(clazz))
                {
                    GradleStartCommon.LOGGER.info("Found and added coremod: " + clazz);
                    coreMap.put(clazz, coreMod);
                }
            }
        }

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.