LWJGL2 (I can't use 3, im sorry) wont work on my website

Started by andreja6, June 23, 2016, 00:05:28

Previous topic - Next topic

andreja6

I keep getting Failed to start applet (6):null on my applets. I tried self-signing all the jars and stuff, but it keeps happening, and I cant do anything about it. I've seen other websites run working LWJGL2 applets, yet i cant get mine to work!
And as for needing LWJGL2, I need java 6 to run my applets, and my work computers use java 6_17. LWJGL3 dropped support for anything before 8, (the worst version for applet makers)so im stuck with LWJGL2. I don't really mind, as its Display is a lot more understandable to me. Please help.

And if this is the wrong place, please tell me.

This is my code:

package main;

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

public class Test extends Applet {
     
    /**
    *
    */
   private static final long serialVersionUID = 1L;

   Canvas display_parent;
    Thread gameThread;
    boolean running = false;
     
     
    public void startLWJGL() {
        gameThread = new Thread() {
            public void run() {
                running = true;
                try {
                    Display.setParent(display_parent);
                    Display.create();
                    initGL();
                } catch (LWJGLException e) {
                    e.printStackTrace();
                    return;
                }
                gameLoop();
            }
        };
        gameThread.start();
    }
    private void stopLWJGL() {
        running = false;
        try {
            gameThread.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public void start() {
         
    }

    public void stop() {
         
    }
    public void destroy() {
        remove(display_parent);
        super.destroy();
    }
     
    public void init() {
        setLayout(new BorderLayout());
        try {
            display_parent = new Canvas() {
            private static final long serialVersionUID = 1L;
            public final void addNotify() {
                    super.addNotify();
                    startLWJGL();
                }
                public final void removeNotify() {
                    stopLWJGL();
                    super.removeNotify();
                }
            };
            display_parent.setSize(getWidth(),getHeight());
            add(display_parent);
            display_parent.setFocusable(true);
            display_parent.requestFocus();
            display_parent.setIgnoreRepaint(true);
            setVisible(true);
        } catch (Exception e) {
            System.err.println(e);
            throw new RuntimeException("Unable to create display");
        }
    }

    protected void initGL() {
         
    }
     
    public void gameLoop() {
        while(running) {
            Display.sync(60);
            Display.update();
        }
         
        Display.destroy();
    }
}




And yes, I do need it as an applet.