Jump to content

[1.7.10] NoClassDefFoundError When Using External Library


nalexander50

Recommended Posts

I am working on my first, small mod, and I am attempting to use an external jar. The jar is jeval found at http://jeval.sourceforge.net. I placed the jar file in my mod's libs folder, added the jar to my IDEA project with "Export" checked and set to "Compile." Everything works inside the development environment. I can fire up Minecraft from IDEA and everything works flawlessly. However, when I try to real Minecraft with my mod installed, I get a whole slew of ClassDefNotFoundError relating to my external library. If I add BOTH my mod jar AND the external jar to the mods folder, everything works; however, this is not really an ideal solution. I believe everything should get packed into my mod jar. I also had the idea of just packing both jars into a zip and placing in the mods folder which didn't work (as I had expected). I have Google'd and YouTube'd for hours and tried many different solutions to no avail. I appreciate any help - let me know if you need more information!

 

The relevant stacktrace:

 

[03:43:10] [server thread/ERROR] [FML]: Fatal errors were detected during the transition from SERVER_ABOUT_TO_START to SERVER_STARTING. Loading cannot continue

[03:43:10] [server thread/ERROR] [FML]:

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available

FML{7.10.85.1277} [Forge Mod Loader] (forge-1.7.10-10.13.2.1277-universal.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available

Forge{10.13.2.1277} [Minecraft Forge] (forge-1.7.10-10.13.2.1277-universal.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available

chatcalc{1.7.10-0.1} [ChatCalc] (chatcalc-1.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Errored

[03:43:10] [server thread/ERROR] [FML]: The following problems were captured during this phase

[03:43:10] [server thread/ERROR] [FML]: Caught exception from chatcalc

java.lang.NoClassDefFoundError: net/sourceforge/jeval/EvaluationException

at main.java.com.alexander.chatcalc.ChatCalc.serverStart(ChatCalc.java:35) ~[ChatCalc.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[forge-1.7.10-10.13.2.1277-universal.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-16.0.jar:?]

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-16.0.jar:?]

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[forge-1.7.10-10.13.2.1277-universal.jar:?]

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[forge-1.7.10-10.13.2.1277-universal.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-16.0.jar:?]

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-16.0.jar:?]

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) [LoadController.class:?]

at cpw.mods.fml.common.Loader.serverStarting(Loader.java:739) [Loader.class:?]

at cpw.mods.fml.common.FMLCommonHandler.handleServerStarting(FMLCommonHandler.java:278) [FMLCommonHandler.class:?]

at net.minecraft.server.integrated.IntegratedServer.func_71197_b(IntegratedServer.java:94) [bsx.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:387) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) [?:?]

Caused by: java.lang.ClassNotFoundException: net.sourceforge.jeval.EvaluationException

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.11.jar:?]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]

... 32 more

Caused by: java.lang.NullPointerException

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:182) ~[launchwrapper-1.11.jar:?]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]

... 32 more

[03:43:10] [server thread/ERROR] [FML]: A fatal exception occurred during the server starting event

cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/sourceforge/jeval/EvaluationException

at cpw.mods.fml.common.LoadController.transition(LoadController.java:162) ~[LoadController.class:?]

at cpw.mods.fml.common.Loader.serverStarting(Loader.java:740) [Loader.class:?]

at cpw.mods.fml.common.FMLCommonHandler.handleServerStarting(FMLCommonHandler.java:278) [FMLCommonHandler.class:?]

at net.minecraft.server.integrated.IntegratedServer.func_71197_b(IntegratedServer.java:94) [bsx.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:387) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) [?:?]

Caused by: java.lang.NoClassDefFoundError: net/sourceforge/jeval/EvaluationException

at main.java.com.alexander.chatcalc.ChatCalc.serverStart(ChatCalc.java:35) ~[ChatCalc.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[forge-1.7.10-10.13.2.1277-universal.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-16.0.jar:?]

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-16.0.jar:?]

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[LoadController.class:?]

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[LoadController.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-16.0.jar:?]

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-16.0.jar:?]

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) ~[LoadController.class:?]

at cpw.mods.fml.common.Loader.serverStarting(Loader.java:739) ~[Loader.class:?]

... 4 more

Caused by: java.lang.ClassNotFoundException: net.sourceforge.jeval.EvaluationException

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.11.jar:?]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]

at main.java.com.alexander.chatcalc.ChatCalc.serverStart(ChatCalc.java:35) ~[ChatCalc.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[forge-1.7.10-10.13.2.1277-universal.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-16.0.jar:?]

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-16.0.jar:?]

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[LoadController.class:?]

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[LoadController.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-16.0.jar:?]

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-16.0.jar:?]

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) ~[LoadController.class:?]

at cpw.mods.fml.common.Loader.serverStarting(Loader.java:739) ~[Loader.class:?]

... 4 more

Caused by: java.lang.NullPointerException

at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:182) ~[launchwrapper-1.11.jar:?]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]

at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_25]

at main.java.com.alexander.chatcalc.ChatCalc.serverStart(ChatCalc.java:35) ~[ChatCalc.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]

at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) ~[forge-1.7.10-10.13.2.1277-universal.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-16.0.jar:?]

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-16.0.jar:?]

at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) ~[LoadController.class:?]

at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) ~[LoadController.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25]

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-16.0.jar:?]

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-16.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-16.0.jar:?]

at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) ~[LoadController.class:?]

at cpw.mods.fml.common.Loader.serverStarting(Loader.java:739) ~[Loader.class:?]

... 4 more

 

 

My build.gradle dependencies:

 

dependencies {

    // you may put jars on which you depend on in ./libs

    // or you may define them like so..

    //compile "some.group:artifact:version:classifier"

    //compile "some.group:artifact:version"

 

    // real examples

    //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env

    //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env

 

    // for more info...

    // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html

    // http://www.gradle.org/docs/current/userguide/dependency_management.html

 

    compile files (

            "lib/jeval.jar"

    )

}

 

 

 

Link to comment
Share on other sites

I Think you did it all wrong. In your main project directory create a folder called "libs" and put the mod jar in that that will allow your mod to compile. Then you need to add the jar to your ide as a library but i only know how to do that in idea.

 

For idea go to project structure > Libraries > New project library then navigate to the jar you placed in libs and select it. If you are using eclipse its probably something similar.

 

Also the thing about dependencies is you kind of depend on them for your mod to work. So if you are making a mod that uses another mod as a library you are going to need that other mod installed for it to work.

I am the author of Draconic Evolution

Link to comment
Share on other sites

Hi

 

This thread is probably of interest too. 

http://www.minecraftforge.net/forum/index.php/topic,24358.msg123834.html#msg123834

 

It looks to me like you will probably have to include the lib in your jar file (as a "shadow" library), unless you want everyone who uses your mod to have to install the jeval library manually, or for some reason you want to write your own installer.

 

-TGG

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.