I use Intellij Java 2016.2.2 and Maven to create a very simple Java console application.
I want to add an external library, so I add my dependency to Maven as follows:
<dependency> <groupId>jline</groupId> <artifactId>jline</artifactId> <version>2.12</version> </dependency>
It works fine when I run it in the IDE, but not in the external console (I have the following error: java.lang.NoClassDefFoundError).
I checked, and for some reason, the external JAR is not added to the JAR that I just generated. I also tried a lot of things in โFile โ Project Structureโ, but still not working ...
I just want to create a JAR with my dependencies, so I can just run my application in the console using:
java -jar myproject.jar
How can i do this? Thank you for your help!
source share