Applet Problem

Started by Corvinex, December 04, 2008, 00:23:49

Previous topic - Next topic

Corvinex

Hey i'm new to LWJGL and I'm having problems getting the Applet capabilities to work.
All the test demos work, but when I try to create an Applet myself I get an error on the line with: Display.setParent(display_parent);

Here is the code i have:

Quote
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Canvas;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;

public class LWJGLapplet extends Applet {
   
   Canvas display_parent;
   Thread gameThread;
   
   boolean running = false;

   public void destroy() {
      super.destroy();
      running = false;
      System.out.println("*** destroy ***");
   }

   public void start()
   {
      super.start();
      System.out.println("*** start ***");
      gameThread = new Thread()
      {
         public void run()
         {
            running = true;
            try
            {
               System.out.println("display_parent.isDisplayable() = " + display_parent.isDisplayable());
               Display.setParent(display_parent);
               //Display.setVSyncEnabled(true);
               Display.create();
            }
            catch (LWJGLException e)
            {
               e.printStackTrace();
            }
            //gameLoop();
         }
      };
      gameThread.start();
   }

   public void stop() {
      super.stop();
      System.out.println("*** stop ***");
   }

   public void init()
   {
      setLayout(new BorderLayout());
      try {
         display_parent = new Canvas() {
            public final void removeNotify() {
               super.removeNotify();
            }
         };
         display_parent.setSize(getWidth(),getHeight());
         add(display_parent);
         display_parent.setFocusable(true);
         display_parent.requestFocus();
         display_parent.setIgnoreRepaint(true);
         //setResizable(true);
         setVisible(true);
      } catch (Exception e) {
         System.err.println(e);
         throw new RuntimeException("Unable to create display");
      }
   }
}

And the error i get is:
QuoteException in thread "Thread-14" java.lang.ExceptionInInitializerError
   at org.lwjgl.Sys.createImplementation(Sys.java:109)
   at org.lwjgl.Sys.<clinit>(Sys.java:97)
   at org.lwjgl.opengl.Display.<clinit>(Display.java:129)
   at VirusEffect$1.run(LWJGLapplet.java:47)
Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission org.lwjgl.util.Debug read)
   at java.security.AccessControlContext.checkPermission(Unknown Source)
   at java.security.AccessController.checkPermission(Unknown Source)
   at java.lang.SecurityManager.checkPermission(Unknown Source)
   at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
   at java.lang.System.getProperty(Unknown Source)
   at java.lang.Boolean.getBoolean(Unknown Source)
   at org.lwjgl.LWJGLUtil$4.run(LWJGLUtil.java:451)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.lwjgl.LWJGLUtil.getPrivilegedBoolean(LWJGLUtil.java:449)
   at org.lwjgl.LWJGLUtil.<clinit>(LWJGLUtil.java:268)
   ... 4 more

Does it have anything to do with the .html file? I'm pretty sure i did all the appletloader stuff right.

Matzon

did you sign the applet ?

Corvinex

Wow thanks a lot, that was the problem. I thought that if you didn't need to sign the jar in the first place, then running it without signing it and just having the other presigned jars in there would be fine.

Thanks again  :D