MinecraftForge / ForgeGradle

Minecraft mod development framework used by Forge and FML for the gradle build system
GNU Lesser General Public License v2.1
526 stars 447 forks source link

[FG5, J16] runClient task fails due to unnamed module problem #811

Closed KlemenDEV closed 3 years ago

KlemenDEV commented 3 years ago

When running FG5 with J16 with 1.16.5 using runClient task, the launch fails with error:

Exception in thread "main" java.lang.IllegalAccessError: class cpw.mods.modlauncher.SecureJarHandler (in unnamed module @0x57f23557) cannot access class sun.security.util.ManifestEntryVerifier (in module java.base) because module java.base does not export sun.security.util to unnamed module @0x57f23557 
   at cpw.mods.modlauncher.SecureJarHandler.lambda$static$1(
SecureJarHandler.java:41
   at cpw.mods.modlauncher.SecureJarHandler.lambda$static$1(SecureJarHandler.java:41) 
   at cpw.mods.modlauncher.api.LamdbaExceptionUtils.uncheck(
LamdbaExceptionUtils.java:95
   at cpw.mods.modlauncher.api.LamdbaExceptionUtils.uncheck(LamdbaExceptionUtils.java:95) 
   at cpw.mods.modlauncher.SecureJarHandler.<clinit>(
SecureJarHandler.java:41
   at cpw.mods.modlauncher.SecureJarHandler.<clinit>(SecureJarHandler.java:41) 
   at cpw.mods.modlauncher.Launcher.lambda$new$6(
Launcher.java:55
   at cpw.mods.modlauncher.Launcher.lambda$new$6(Launcher.java:55) 
   at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(
ConcurrentHashMap.java:1708
   at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708) 
   at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(
TypesafeMap.java:52
   at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:52) 
   at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(
TypesafeMap.java:47
   at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:47) 
   at cpw.mods.modlauncher.Environment.computePropertyIfAbsent(
Environment.java:62
   at cpw.mods.modlauncher.Environment.computePropertyIfAbsent(Environment.java:62) 
   at cpw.mods.modlauncher.Launcher.<init>(
Launcher.java:55
   at cpw.mods.modlauncher.Launcher.<init>(Launcher.java:55) 
   at cpw.mods.modlauncher.Launcher.main(
Launcher.java:66
   at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) 
   at net.minecraftforge.userdev.LaunchTesting.main(
LaunchTesting.java:105
   at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105)
sciwhiz12 commented 3 years ago

Known issue with Java 16 and 1.16.5, because securejarhandler accesses JDK internals which is now forbidden by default on Java 16 (on Java 9-15, it was set to warn only by default).

Solution is on the user side, by adding the --illegal-access=warn command-line JVM argument on Java 16 at least. On Java 17 and higher, more refined JVM arguments -- --add-opens, forcing open the required JDK modules to the securejarhandler module -- will replace that argument (as can be found in the Forge discord). Note that in 1.17 Forge (as previewed in the discord), these refined JVM arguments are added by default on install to the profile/dedicated server.

I would also like to note that this is technically the invalid repository for this, as this is a Forge issue and not a ForgeGradle one.

KlemenDEV commented 3 years ago

I would also like to note that this is technically the invalid repository for this, as this is a Forge issue and not a ForgeGradle one.

My bad. I assume this is resolved then so I am closing this issue.