Jump to content

[1.19.2] Unable to use external libraries at runtime (NoClassDefFoundError)


SnakerBone

Recommended Posts

Hi!

I've been trying to use external libraries like JOML (for animating) and Jsoup (for html parsing), It compiles fine, however at runtime if I call a class that uses one of these external libraries it crashes my game saying "ClassNotFoundException: {external library maven url here}".

Here's my relevant code:

// build.gradle

dependencies {
    minecraft "net.minecraftforge:forge:${mc_version}-43.2.0"
	
	// Other dependencies...	

    implementation "org.joml:joml:${joml_version}"
    implementation "org.jsoup:jsoup:${jsoup_version}"
}
// gradle.properties

joml_version=1.10.5
jsoup_version=1.16.1
// Class using external joml library (crashes when I call this method)

    public Quaternionf toQuatf(float x, float y, float z, float w)
    {
        return new Quaternionf(x, y, z, w);
    }

If I'm missing something please let me know! I'm not so familiar with Gradle as I originally used maven Poms/XMLs with Java xD

Link to comment
Share on other sites

7 hours ago, SnakerBone said:

I've been trying to use external libraries like JOML (for animating) and Jsoup (for html parsing), It compiles fine, however at runtime if I call a class that uses one of these external libraries it crashes my game saying "ClassNotFoundException: {external library maven url here}".

 

First, use Mojang's math functions pre 1.19.3. If you want to use JOML, update to 1.19.3 or later, since Mojang switched off the library.

 

Second, non-mod artifacts need to be added using the `minecraftLibrary` configuration, so it gets picked up by the class loader.

Link to comment
Share on other sites

39 minutes ago, ChampionAsh5357 said:

First, use Mojang's math functions pre 1.19.3. If you want to use JOML, update to 1.19.3 or later, since Mojang switched off the library.

 

Second, non-mod artifacts need to be added using the `minecraftLibrary` configuration, so it gets picked up by the class loader.

Thanks 🙂 I wasn't aware mojang started using JOML in 1.19.3 my bad haha

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.