mezz / JustEnoughItems

Item and Recipe viewing mod for Minecraft
https://www.curseforge.com/minecraft/mc-mods/jei
MIT License
775 stars 303 forks source link

[Crash]: Unsupported class file major version 65 (Java 21) #3624

Closed Luis-St closed 2 months ago

Luis-St commented 2 months ago

Steps to Reproduce the Crash

Include Jei as a dependency in a mod, as described in the wiki:

repositories {
    maven {
        name = "Jared's maven"
        url = "https://maven.blamejared.com/"
    }
    maven {
        name = "ModMaven"
        url = "https://modmaven.dev/"
    }
}

dependencies {
    minecraft "net.minecraftforge:forge:${MinecraftVersion}-${ForgeVersion}"

    implementation('net.sf.jopt-simple:jopt-simple:5.0.4') { version { strictly '5.0.4' } }

    compileOnly(fg.deobf("mezz.jei:jei-1.21-common-api:19.5.0.47"))
    compileOnly(fg.deobf("mezz.jei:jei-1.21-forge-api:19.5.0.47"))
    runtimeOnly(fg.deobf("mezz.jei:jei-1.21-forge:19.5.0.47"))
}

Mod Pack URL (Optional)

No response

Mod Pack Version (Optional)

No response

Extra Notes (Optional)

Minecraft Version: 1.21 Forge Version: 51.0.26 Jei Version: 19.5.0.47 - 19.5.0.40

I have already tried:

  1. Running gradlew clean
  2. Fully reimport the project
  3. Setup a new project

Crash Report

https://gist.github.com/Luis-St/5772d57c1b63411ee9886db11b702f9b

mezz commented 2 months ago

Thanks for the report! This issue is not specific to JEI, I have run into it before. Your gradle is probably outdated for this Java version, make sure you're using gradle-8.8 and I think it should resolve the problem.

Luis-St commented 2 months ago

Hey, thanks for the response. It does not fixed the issue, i still get the same error. I have tired gradle version 8.8 and 8.9 (all and bin only).

The bug is must be related to jei, without jei everything works fine.

mezz commented 2 months ago

I asked around about your issue, and the suggestion is to make sure you're running Gradle using Java 21 and not a lower version. Apparently this can happen if you use an older Java version. I wish the error was more clear...

jstansel commented 2 months ago

Really puzzling. This error is repeated several times in the linked gist:

Error getting artifact: mezz.jei:jei-1.21-common-api:19.5.0.47_mapped_official_1.21:null@jar from DeobfuscatingRepo org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Luis.jdks\temurin-21.0.4\bin\java.exe'' finished with non-zero exit value 1

However, gradle 8.7 is referenced at the bottom:

For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

mezz commented 2 months ago

The ForgeGradle version may also be outdated, I am not able to see what's being used from the log.

Luis-St commented 2 months ago

Hey, i fixed the issue, the issue was caused by the new runtime mojang mappings used by forge. Thanks for your supports guys

mezz commented 2 months ago

Thanks @Luis-St Can you please explain the exact steps you took to resolve the issue, so that I can direct people here if they run into the same problem?

Luis-St commented 2 months ago

Yeah sure, but there is nothing special about the solution. Just make sure you set reobf to false in the minecraft block inside the build.gradle, and fg.deobf is not used to include dependencies.

You should probably update your wiki.

Edit: The reobfJar Task in gradle must also not be executed.

mezz commented 2 months ago

Thanks, I've added a new wiki page here: https://github.com/mezz/JustEnoughItems/wiki/Getting-Started-%5BJEI-for-Minecraft-1.21-for-NeoForge,-Forge,-or-Fabric%5D