Skip to content

NoClassDefFoundError when launching in game, works fine in IntelliJ #4020

Discussion options

You must be logged in to vote

It doesn't crash in your IDE because Gradle pulls in all the dependencies for you.
However those dependencies do not get put in the built JAR unless you specifically ask for that, because often that's not what you want.

There are two ways to package dependencies:

  1. Fabric's include Gradle configuration (a.k.a. jar-in-jar).
  2. The Gradle Shadow plugin

include is the easiest to use, and the best option for packaging mods. It also works well for non-mod dependencies that have few dependencies of their own. The typical issues people have are:

  • it only packages the specified dependency, not any transitive dependencies (dependencies of dependencies). This is because for its main usecase of packagi…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Raynuz
Comment options

Answer selected by Raynuz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
2 participants