Reputation: 47
I get NoClassDefFoundError at jsoup library trying to run my project jar on other computer. I added jsoup as maven dependency, added in project settings-modules-dependencies, though I get same Exc. I run project via:
java -classpath lostfilm-1.0.jar project.start.Entrance
Please tell me where am I wrong. 4.0.0
<groupId>lostfilm</groupId>
<artifactId>lostfilm</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<modules>
</modules>
<dependencies>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.7.3</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
Upvotes: 1
Views: 1534
Reputation: 159864
Add the JSoup
jar file to your classpath
java -classpath lostfilm-1.0.jar;jsoup.jar project.start.Entrance
Upvotes: 1
Reputation: 7894
Add this to your POM:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<mainClass>project.start.Entrance</mainClass>
</configuration>
</plugin>
</plugins>
</build>
and then run
mvn exec:java
from the root directory of your project. Running your code this way will pull in all your maven dependencies without adding them to command line.
Upvotes: 1