I'm working on a Neoforge 1.21.1 Mod that uses GraalPy to run a python script within the minecraft runtime. Anytime I try to run the script, it throws a java.lang.NoClassDefFoundError: org/graalvm/polyglot/Context error. Below is the part of my build.gradle with dependencies and plugins. Any help is much appreciated.
mavenCentral is already in repositories, no worries there.
plugins {
id 'java-library'
id 'maven-publish'
id 'net.neoforged.moddev' version '2.0.106'
id 'idea'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
dependencies {
// compile against the JEI API but do not include it at runtime
compileOnly("mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}")
// at runtime, use the full JEI jar for NeoForge
runtimeOnly("mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}")
implementation("org.graalvm.polyglot:polyglot:24.2.2")
implementation("org.graalvm.polyglot:python:24.2.2")
implementation("org.graalvm.sdk:graal-sdk:24.2.2")
implementation("org.graalvm.truffle:truffle-api:24.2.2")
}
I tried Shadowing stuff but it hasn't worked. The expectation is simple, I run the script, it runs the python script. What I actually get is the game crashes and the crash report says that.
java --version
of the JDK you are using to run the program? Please also include the stack trace. You can do so by editing your question.org.graalvm
dependency versions to something that starts with21
instead of24
?