Jump to content

Shadowing javafx into jar, Forge not loading mod


Recommended Posts

Hi, I am currently coding a mod that needs javafx as dependency, but whatever i try it just doesn't want to load or build my mod... If i import any of the javafx classes in my mod, the mod just stops working.
To get javafx into the mod i shadow all of the dependencies into the jar with the code below but the build task errors with the error below... Does someone know what i am doing wrong?

I also tried just putting the javafx jars in my mods folder but that didn't work, so i think i have to shadow them in...

Also sometimes when i change the way i shade the dependencies it does build the mod, but Forge fails to load it, forge gives me the error listed under the other error...

For extra info: i am able to build the jar perfectly fine without the shading

configurations {

dependencies {
    shade "org.openjfx:javafx-web:19:win"
    shade "org.openjfx:javafx-graphics:19:win"
    shade "org.openjfx:javafx-controls:19:win"
    shade "org.openjfx:javafx-base:19:win"

shadowJar {
    dependencies {
    configurations = [project.configurations.shade]
    duplicatesStrategy DuplicatesStrategy.EXCLUDE //prevent duplicates
    classifier "" //prevent creation of unshadowed jar

reobf {
    //reobfuscate the shadowed jar
    shadowJar {}

Execution failed for task ':reobfShadowJar'.
        > java.lang.IllegalArgumentException (no error message)


The game crashed whilst there was a severe problem during mod loading that has caused the game to fail Error: net.minecraftforge.fml.common.LoaderException: java.lang.ClassNotFoundException: me.gwoonryan.videoplayer.VideoPlayer

(VideoPlayer is the main class that imports javafx classes)

Edited by gwoonryan
More specific info added
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.

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.