C
C
CyberKing2020-08-20 23:14:51
Java
CyberKing, 2020-08-20 23:14:51

How to fix error: Exception in thread "main" java.lang.NoClassDefFoundError: com/github/sarxos/v4l4j/V4L4J?

I want to get an image from the camera. I work with Rasberry Pi. But the exception crashes: Exception in thread "main" java.lang.NoClassDefFoundError: com/github/sarxos/v4l4j/V4L4J
The code is taken from the example

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Vashurin, 2020-08-21
@Saddamko

It was on Githab 5 years ago :)
The very message that to execute java cannot find and connect the required class, you need to add ready-made jars to the CLASSPATH execution path or add it to the assembly as an artifact manually.
Rewrite the JAR file with missing classes to . Hands add to your pom.xml file at the root of the project:<PROJECT_ROOT_FOLDER>/lib

<dependency>
<groupId>webcam-capture-driver-v4l4j</groupId>
<artifactId>webcam-capture-driver-v4l4j</artifactId>
<version>0.3.11-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${basedir}/lib/yourJar.jar</systemPath>
</dependency>

After adding it to pom.xml, the description of the dependency will appear in the IDE (let's say Netbeans), but it will not download, click "Install dependency manually" and point to the local jar in the lib directory.
Here is the original comment from Github (the link to the Jar seems to be broken, here it is ):
sarxos commented on 22 May 2015
@charlie23k,
Yes, it's possible to use Webcam Capture API with RasPi Camera Module.
The NoClassDefFoundError clearly states that you are missing some classes. This is because you haven't added required JARs into your application's classpath.
On the page I linked in the previous post:
https://github.com/sarxos/webcam-capture/wiki/How-...
There is a statement:
The following JARs are required:
The webcam-capture-driver-v4l4j JAR can be found here, and
The V4L4J JAR itself which can be found here (the project and source code is available here ).
Which means that you have to download them and add to your application's classpath. Otherwise the code will not work and will rise exception same as yours. You are missing JAR from second bullet (V4L4J). It can be found here:
http://search.maven.org/#artifactdetails|com.githu...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question