Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8215774

cannot run project using gradle - Base ClassLoader can not be cast to URLClassLoader

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      gradle 4.2
      eclipse 12/2018
      windows 10 version 1809
      java JDK 11.0.1

      A DESCRIPTION OF THE PROBLEM :
      2018-12-19 07:56:04,478 main WARN Disabling terminal, you're running in an unsupported environment.
      WARNING: An illegal reflective access operation has occurred
      WARNING: Illegal reflective access by GradleStart (file:/C:/Users/Daniel/.gradle/caches/minecraft/net/minecraftforge/forge/1.12.2-14.23.4.2705/start/) to field java.lang.ClassLoader.sys_paths
      WARNING: Please consider reporting this to the maintainers of GradleStart
      WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
      WARNING: All illegal access operations will be denied in a future release
      [07:56:04] [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:85)
      at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:86)
      at GradleStart.main(GradleStart.java:25)


      REGRESSION : Last worked in version 8u172

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. download forge devolopment kit (does not recognise 11.0.1 as java version number)
      2. install forge development kit (MDK)
      3. update java to JDK 11
      4. download and install eclipse
      5. locate MDK workspace
      6. try to launch <folderName>_Client.launch

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Minecraft starts
      ACTUAL -
      Nothing runs and it throws this error

      ---------- BEGIN SOURCE ----------
      package com.example.examplemod;

      import net.minecraft.init.Blocks;
      import net.minecraftforge.fml.common.Mod;
      import net.minecraftforge.fml.common.Mod.EventHandler;
      import net.minecraftforge.fml.common.event.FMLInitializationEvent;
      import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
      import org.apache.logging.log4j.Logger;

      @Mod(modid = ExampleMod.MODID, name = ExampleMod.NAME, version = ExampleMod.VERSION)
      public class ExampleMod
      {
          public static final String MODID = "examplemod";
          public static final String NAME = "Example Mod";
          public static final String VERSION = "1.0";

          private static Logger logger;

          @EventHandler
          public void preInit(FMLPreInitializationEvent event)
          {
              logger = event.getModLog();
          }

          @EventHandler
          public void init(FMLInitializationEvent event)
          {
              // some example code
              logger.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
          }
      }

      ---------- END SOURCE ----------

      FREQUENCY : always


            pmangal Priyanka Mangal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: