I have an web application which connect with a security by javaCV. My applet Works perfectly when I execute in the desktop. However, when I integrate this in my JSF page, there are no errors, but the instance of OpenCVFrameGrabber does not start. why? Below is how I call the Applet in the web page (all dependencies are already in the jar):
<applet code="com.br.spacnet.camera.CameraApplet" archive="CameraApplet.jar" width="1000" height="1000"/>
Below is the source code of the applet (here I'm using local camera connection for test purposes):
try {
OpenCVFrameGrabber grabber = new OpenCVFrameGrabber(0);
jLabel1.setText(jLabel1.getText() + "; instanciou o grabber");
//grabber.setFormat("mjpeg");
grabber.start();
jLabel1.setText(jLabel1.getText() + "; iniciou o Grab");
opencv_core.IplImage frame = grabber.grab();
while (jPanel1.isVisible()) {
jLabel1.setText(jLabel1.getText() + "; entrou no laço");
jPanel1.getGraphics().drawImage(frame.getBufferedImage(), 0, 0, 320, 240, null);
jLabel1.setText(jLabel1.getText() + "; redesenhou painel");
}
grabber.stop();
jLabel1.setText(jLabel1.getText() + "; parou o grabber");
System.exit(0);
} catch (Exception ex) {
jLabel1.setText("Erro " + ex.getMessage());
}
Thanks, Andrew Thompson! I enabled my Java Console and I could see several security bloks of JRE. So, I added the following lines to the java.policy, and it worked fine:
permission java.util.PropertyPermission "org.bytedeco.javacpp.loadlibraries", "read";
permission java.util.PropertyPermission "org.bytedeco.javacpp.platform", "read";
permission java.security.AllPermission;
permission java.lang.RuntimePermission "shutdownHooks";