I've created a Discord bot in Eclipse and want to export it (Jar file). The problem is: I can't run it. Each time I try to start it it gives me this error: java.lang.NoClassDefFoundError: net/dv8tion/jda/core/entities/Game
I'm using "JRE System Library [JavaSE-1.8]" for my program.
This here is my pom.xml file https://pastebin.com/bcs51jm9
After some research it seems like Eclipse doesn't implement the Maven Librarys into the Jar-file.
How can I fix this?
Exporting a jar with Eclipse from the wizard is generally the way when you don't have a build tool that allows to do it in a straight way.
You use Maven. So you have this tool.
What you need is configuring your pom.xml to enable the assembly plugin execution with the jar-with-dependencies
descriptorRef.
It allows to specify the main class and to create a fat jar that contains all required dependencies at runtime according to the Maven dependencies declaration defined in your pom.
By executing mvn assembly:single
you could so generate an additional jar : a jar-with-dependencies
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.