|
使用oracle jdk8 for arm。
pc上执行没问题,但是在cb2上执行出现如下错误。
root@cubieboard2:/usr/pic4# sh run.sh
Java HotSpot(TM) Client VM warning: You have loaded library /usr/pic4/libbridj.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/libs3835851625471576394/libvideo.so: /tmp/libs3835851625471576394/libvideo.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1847)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at au.edu.jcu.v4l4j.NativeUtils.loadLibraryFromJar(NativeUtils.java:98)
at au.edu.jcu.v4l4j.V4L4J.init(V4L4J.java:16)
at com.github.sarxos.webcam.ds.v4l4j.V4l4jDriver.<clinit>(V4l4jDriver.java:36)
at com.can.webcam.TestCam.main(TestCam.java:20)
运行脚本是:
CLASSPATH=$CLASSPATH:./bridj-0.6.3-20130316.190111-13.jar:./kwebcam.jar:./v4l4j-0.9-WC.jar:./slf4j-api-1.7.2.jar:./webcam-capture-0.3.10-RC7.jar:./webcam-capture-driver-jmf-0.3.10-RC7.jar:./webcam-capture-driver-v4l4j-0.3.10-RC7.jar:./slf4j-nop-1.7.7.jar:.:
java com.can.webcam.TestCam
测试类:
package com.can.webcam;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.ds.v4l4j.V4l4jDriver;
public class TestCam {
/**
* @param args
*/
public static void main(String[] args) {
// get default webcam and open it
Webcam webcam = Webcam.getDefault();
Webcam.setDriver(new V4l4jDriver());
webcam.open();
// get image
BufferedImage image = webcam.getImage();
// save image to PNG file
try {
ImageIO.write(image, "PNG", new File("test.png"));
ImageIO.write(image, "PNG", new File("/var/test.png"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void getPic() {
// get default webcam and open it
Webcam webcam = Webcam.getDefault();
webcam.open();
// get image
BufferedImage image = webcam.getImage();
// save image to PNG file
try {
ImageIO.write(image, "PNG", new File("test.png"));
ImageIO.write(image, "PNG", new File("/var/lib/tomcat6/webapps/ROOT/test.png"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} |
|