0

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.

asked Aug 23 at 8:06
6
  • Are you running the program with GraalVM (which version?) or with a different JDK? Which version? Can you post the full output of 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. Commented Aug 23 at 11:18
  • @dan1st I'm running it on the basic jdk, version 21. Running it in IntelliJ IDEA. I'll get the java --version and stack trace when I get to that computer. Commented Aug 27 at 14:36
  • Can you try to change the org.graalvm dependency versions to something that starts with 21 instead of 24? Commented Aug 27 at 15:28
  • @dan1st Tried that, throws a cannot find error when I try to build. Commented Aug 28 at 14:49
  • What version did you use and what error are you getting? Commented Aug 28 at 15:38

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.