I need some help trying to run the following maven project using the command line: https://github.com/sarxos/webcam-capture, the webcam-capture-qrcode example is the one I'm trying to run. I have it running using an the Eciplse IDE but need to move it over to just using the command line. I have the jar's created by maven.
I'm trying
java -classpath ./webcam-capture/target/webcam-capture-0.3.10-SNAPSHOT.jar com.github.sarxos.webcam.WebcamQRCodeExample
but I keep getting the
Exception in thread "main" java.lang.NoClassDefFoundError: com/github/sarxos/webcam/WebcamQRCodeExample Caused by: java.lang.ClassNotFoundException: com.github.sarxos.webcam.WebcamQRCodeExample
7. Running a Maven build via the command line. To build a Maven project via the command line, you use the mvn command from the command line. The command must be executed in the directory which contains the relevant pom file.
Just use the exec-maven-plugin
.
<build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>com.example.Main</mainClass> </configuration> </plugin> </plugins> </build>
Then you run you program:
mvn exec:java
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With