0

I'm trying to attach a phidget interface kit to my applet, and it gives me this error:

java.lang.ExceptionInInitializerError
    at AppletTest.init(AppletTest.java:15)
    at sun.applet.AppletPanel.run(AppletPanel.java:434)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "loadLibrary.phidget21")
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:366)
    at java.security.AccessController.checkPermission(AccessController.java:555)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
    at java.lang.SecurityManager.checkLink(SecurityManager.java:835)
    at java.lang.Runtime.loadLibrary0(Runtime.java:839)
    at java.lang.System.loadLibrary(System.java:1084)
    at com.phidgets.Phidget.<clinit>(Phidget.java:26)
    ... 3 more

I asked on the phidget forums, and no answer. Does anyone have any experience with phidgets and know what's going on?

Website: http://www.phidgets.com/

My code:

import java.applet.Applet;
import com.phidgets.*;
import com.phidgets.event.*;
import java.awt.*;

public class AppletTest extends Applet implements Runnable
{
  private InterfaceKitPhidget ik;

  public void init()
  {

     try
     {
        ik = new InterfaceKitPhidget();
        ik.openAny();
        System.out.println("Waiting for interface kit attachement..");
        ik.waitForAttachment();
     }
        catch (PhidgetException e)
        {
           System.out.println("Phidget Exception");
        } 

  }

  public void start()
  {
  }

  public void stop()
  {
  }

  public void destroy()
  {
  }

  public void paint(Graphics g)
  {
  }

  public void run()
  {
  }
}
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • Welcome to the wonderful world of Applet restrictions. Basically, your applet runs in a very restricted sand box, which is preventing it from loading a required external library `loadLibrary.phidget21`. – MadProgrammer Apr 23 '13 at 03:02
  • Is there any way to get around it? I've already built a full program on using an applet, and then tried to implement the phidgets only to get this error. – user2309560 Apr 23 '13 at 03:05
  • 1
    Check out [this](http://stackoverflow.com/questions/12154013/load-dll-with-applet-and-use-it-on-client) – MadProgrammer Apr 23 '13 at 03:07
  • If your application is dedicated to hardware control, a desktop application seems to be more applicable than an Applet, see Java Web Start for the deployment concerns. – Aubin Apr 23 '13 at 03:25
  • So without a signature file (I checked the META_INF, only the manifest was there) there is no way I can use an applet? – user2309560 Apr 23 '13 at 03:28

0 Answers0