getting NoClassDefFoundError Jsoup with Maven
posted 1 year ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi there
I'm trying Jsoup and Maven by following the Jsoup handbook but have issues running the code.
So I created a project using maven and added Jsoup as a dependency, this is the POM:
and this is my only java file:
and tried creating an excutable jar file using both and then running the jar file via but I get this exception:
I would appreciate any help
I'm trying Jsoup and Maven by following the Jsoup handbook but have issues running the code.
So I created a project using maven and added Jsoup as a dependency, this is the POM:
and this is my only java file:
and tried creating an excutable jar file using both and then running the jar file via but I get this exception:
I would appreciate any help
I did not climb to the top of the food chain to eat Java errors
posted 1 year ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Java expects you to put all your dependencies on the class path. The only JAR you have on your classpath is your exbook JAR.
There are 4 ways you can solve this problem:
Add JSoup to the class path when you call the java command. Add JSoup to your JAR's Class-Path manifest entry. Use exec-maven-plugin to run your application. Create a "fat JAR" that includes both JSoup and your own classes.
Using exec-maven-plugin would be my personal preference, but your POM already contains a start for creating a fat JAR. All you need to do is finish configuring maven-assembly-plugin and then add it to the list of plugins to execute when you're building your application.
There are 4 ways you can solve this problem:
Using exec-maven-plugin would be my personal preference, but your POM already contains a start for creating a fat JAR. All you need to do is finish configuring maven-assembly-plugin and then add it to the list of plugins to execute when you're building your application.
posted 1 year ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Thanks for reply Stephan van Hulst
I was able to run the program using exec-maven-plugin fine but I can't generate a fat jar.
So I updated these attributes of POM:
And tried making jar file by running mvn package however the jar-with-dependencies is not made and I get a normal JAR which returns following error after excuting
ok Campbell Ritchie thanks for notifying.
I was able to run the program using exec-maven-plugin fine but I can't generate a fat jar.
So I updated these attributes of POM:
And tried making jar file by running mvn package however the jar-with-dependencies is not made and I get a normal JAR which returns following error after excuting
Not a “Beginning” topic: moved to our Maven forum.
ok Campbell Ritchie thanks for notifying.
I did not climb to the top of the food chain to eat Java errors
| Come have lunch with me Arthur. Adventure will follow. This tiny ad: Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |











