Developed a Maven project in NetBeans .
I am trying to run it with a JAR command
java -cp MyProject-0.1.0.jar ru.com.myproject.Main
Where
ru.com.myproject.Main
there is a main class, because despite the fact that I indicated the main class in
Project properties> Run> Main class it is still not specified in the manifest ...
I get the error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/thetransactioncompany/jsonrpc2/JSONRPC2Parser at ru.com.myproject.<clinit>(Main.java:28) Caused by: java.lang.ClassNotFoundException: com.thetransactioncompany.jsonrpc2.JSONRPC2Parser at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ... 1 more
Contents of the pom file:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>ru.com</groupId> <artifactId>MyProject</artifactId> <version>0.1.0</version> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>com.thetransactioncompany</groupId> <artifactId>jsonrpc2-base</artifactId> <version>1.38</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.1</version> <type>jar</type> </dependency> <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>maven-surefire-common</artifactId> <version>2.17</version> <type>jar</type> </dependency> </dependencies> </project>
So how do you build the Maven project in NetBeans so that the manifest file is configured correctly: was the main class and dependencies correctly registered?
Or how to run the assembled Maven project?