We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, What am I doing wrong.
package videotest;
import processing.core.*;
import processing.video.*;
public class VideoTest extends PApplet {
Capture cam;
public void setup() {
size(640, 480);
String[] cameras = Capture.list(); <----- Hier kommt die Fehlermeldung
if (cameras.length == 0) {
println("There are no cameras available for capture.");
exit();
} else {
println("Available cameras:");
for (int i = 0; i < cameras.length; i++) {
println(cameras[i]);
}
// The camera can be initialized directly using an
// element from the array returned by list():
cam = new Capture(this, cameras[0]);
cam.start();
}
}
public void draw() {
if (cam.available() == true) {
cam.read();
}
image(cam, 0, 0);
// The following does the same, and is faster when just drawing the image
// without any additional resizing, transformations, or tint.
//set(0, 0, cam);
}
}
Exception in thread "Animation Thread" java.lang.NoClassDefFoundError: com/sun/jna/Platform
at processing.video.LibraryPath.get(Unknown Source)
at processing.video.Video.buildWindowsPaths(Unknown Source)
at processing.video.Video.initImpl(Unknown Source)
at processing.video.Video.init(Unknown Source)
at processing.video.Capture.list(Unknown Source)
at processing.video.Capture.list(Unknown Source)
at videotest.VideoTest.setup(VideoTest.java:16)
at processing.core.PApplet.handleDraw(PApplet.java:2361)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
at processing.core.PApplet.run(PApplet.java:2256)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Platform
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 11 more
I suspect that the first line shows the error describes. But I do not understand. I am grateful for any help. Software is up to date. With the Processing IDE everything is OK. Regards Willi
Answers
What version of Java do you use in your Eclipse project?
Thank you for your interest. Version 8 Update 31 (Build 1.8.0_31-b13) Regards Willi
Version: Kepler Release Build id: 20130614-0229
Hey PhiLho, have a solution?
There are three jar files in processing/modes/java/libraries/video/library, including a jna.jar.
Do you import them all?
Hey, yes, I have
In your project build settings?
The jna.jar file of Processing 2.2.1 has the missing class.
Thank you, thank you thank you. I took the 3 jar's from the project folder. That was the mistake. Now it works fine. Best regards Willi
This can only see an expert. ;)