Jmonkey applet errors

Hello,
Im trying to run an applet on the browser but im stuck with some errors.
I built the applet using the jmonkey applet checkbox setting and im opening the default .html file generated by the SDK.

Hopefully waiting for some help.

The console log with the errors while opening the applet through the .html file:

CacheEntry[file:/C:/Users/murilo/Documents/jMonkeyProjects/myAnimation/dist/Applet/lwjgl_util_applet.jar]: updateAvailable=false,lastModified=Mon Jul 08 09:49:22 BRT 2013,length=40729
Missing Permissions manifest attribute in main jar: file:/C:/Users/murilo/Documents/jMonkeyProjects/myAnimation/dist/Applet/lwjgl_util_applet.jar
CacheEntry[file:/C:/Users/murilo/Documents/jMonkeyProjects/myAnimation/dist/Applet/lzma.jar]: updateAvailable=false,lastModified=Mon Jul 08 09:49:22 BRT 2013,length=9661
null
null
mai 11, 2015 8:27:11 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.0.10
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.lwjgl.util.applet.AppletLoader$4.getPermissions(AppletLoader.java:1206)
at java.security.SecureClassLoader.getProtectionDomain(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.jme3.system.JmeDesktopSystem.newContextLwjgl(JmeDesktopSystem.java:159)
at com.jme3.system.JmeDesktopSystem.newContext(JmeDesktopSystem.java:239)
at com.jme3.system.JmeSystem.newContext(JmeSystem.java:138)
at com.jme3.app.Application.createCanvas(Application.java:416)
at com.jme3.app.AppletHarness.createCanvas(AppletHarness.java:118)
at com.jme3.app.AppletHarness.init(AppletHarness.java:153)
at org.lwjgl.util.applet.AppletLoader.switchApplet(AppletLoader.java:1330)
at org.lwjgl.util.applet.AppletLoader$2.run(AppletLoader.java:909)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at sun.plugin2.applet.Plugin2ClassLoader.loadAllowedCodebases(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.getPermissions(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.getPermissions(Unknown Source)
… 39 more
applet:init
applet:start
Exception in thread “LWJGL Renderer Thread” java.lang.ExceptionInInitializerError
at org.lwjgl.Sys.createImplementation(Sys.java:124)
at org.lwjgl.Sys.(Sys.java:111)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:206)
at java.lang.Thread.run(Unknown Source)
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 sun.plugin2.applet.AWTAppletSecurityManager.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:454)
at org.lwjgl.LWJGLUtil$4.run(LWJGLUtil.java:452)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.LWJGLUtil.getPrivilegedBoolean(LWJGLUtil.java:452)
at org.lwjgl.LWJGLUtil.(LWJGLUtil.java:265)
… 4 more

Here’s my main.class code:

package mygame;

import com.jme3.animation.AnimChannel;
import com.jme3.animation.AnimControl;
import com.jme3.animation.AnimEventListener;
import com.jme3.app.SimpleApplication;
import com.jme3.input.ChaseCamera;
import com.jme3.input.KeyInput;
import com.jme3.input.MouseInput;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.AnalogListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.input.controls.MouseAxisTrigger;
import com.jme3.light.DirectionalLight;
import com.jme3.math.FastMath;
import com.jme3.math.Matrix3f;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;

/**
 * test
 *
 * @author normenhansen
 */
public class Main extends SimpleApplication implements AnimEventListener {

    public static void main(String[] args) {
        Main app = new Main();
        app.start();
    }
    Node player;
    AnimChannel channel;
    Quaternion rollOver = new Quaternion();

    @Override
    public void simpleInitApp() {
        getFlyByCamera().setEnabled(false);
        DirectionalLight dl = new DirectionalLight();
        dl.setDirection(new Vector3f(-0.1f, -1f, -1).normalizeLocal());
        DirectionalLight dl2 = new DirectionalLight();
        dl2.setDirection(new Vector3f(100f, 100f, 100).normalizeLocal());
        rootNode.addLight(dl2);
        rootNode.addLight(dl);
        Spatial scene = assetManager.loadModel("Models/stadiuim/stadiuim.j3o");
        player = (Node) assetManager.loadModel("Models/ogrePlayer/playerDude.mesh.j3o");

        player.setMaterial(assetManager.loadMaterial("Materials/newMaterial.j3m"));


        rollOver.fromAngleAxis(FastMath.PI / -2f, new Vector3f(0, 1, 0));
        /* The rotation is applied: The object rolls by 180 degrees. */
        player.setLocalRotation(rollOver);


        scene.scale(122.05f, 122.05f, 122.05f);
        scene.move(0, -2.20f, 0);
        rootNode.attachChild(player);
        rootNode.attachChild(scene);

        AnimControl control = player.getControl(AnimControl.class);
        control.addListener(this);
        channel = control.createChannel();
        // channel.setAnim("my_animation");

        ChaseCamera chaseCam = new ChaseCamera(cam, player, inputManager);
        /**
         * Map one or more inputs to an action
         */
        inputManager.addMapping("frente", new KeyTrigger(KeyInput.KEY_W));
        inputManager.addMapping("tras", new KeyTrigger(KeyInput.KEY_S));
        inputManager.addMapping("esquerda", new KeyTrigger(KeyInput.KEY_A));
        inputManager.addMapping("direita", new KeyTrigger(KeyInput.KEY_D));
        /**
         * Add an action to one or more listeners
         */
        inputManager.addListener(actionListener, new String[]{"frente", "tras", "esquerda", "direita"});

        inputManager.addListener(analogListener, new String[]{"frente", "tras", "esquerda", "direita"});

    }
    /**
     * Use ActionListener to respond to pressed/released inputs (key presses,
     * mouse clicks)
     */
    private ActionListener actionListener = new ActionListener() {
        public void onAction(String name, boolean pressed, float tpf) {
            if (!pressed) {
                channel.reset(paused);
            } else {
                channel.setAnim("my_animation");
                if (name.equals("frente")) {
                    rollOver.fromAngleAxis(FastMath.PI / -2f, new Vector3f(0, 1, 0));
                    /* The rotation is applied: The object rolls by 180 degrees. */
                    player.setLocalRotation(rollOver);
                } else if (name.equals("tras")) {
                    rollOver.fromAngleAxis(FastMath.PI / 2f, new Vector3f(0, 1, 0));
                    /* The rotation is applied: The object rolls by 180 degrees. */
                    player.setLocalRotation(rollOver);

                } else if (name.equals("direita")) {
                    rollOver.fromAngleAxis(FastMath.PI / -1f, new Vector3f(0, 1, 0));
                    /* The rotation is applied: The object rolls by 180 degrees. */
                    player.setLocalRotation(rollOver);
                } else if (name.equals("esquerda")) {
                    rollOver.fromAngleAxis(FastMath.PI / 4f, new Vector3f(0, 1, 0));
                    /* The rotation is applied: The object rolls by 180 degrees. */
                    player.setLocalRotation(rollOver);
                }

            }
        }
    };
    /**
     * Use AnalogListener to respond to continuous inputs (key presses, mouse
     * clicks)
     */
    private AnalogListener analogListener = new AnalogListener() {
        public void onAnalog(String name, float value, float tpf) {
            if (name.equals("frente")) {
                player.move(tpf * -10, 0, 0);
            } else if (name.equals("tras")) {
                player.move(tpf * 10, 0, 0);
            } else if (name.equals("esquerda")) {
                player.move(0, 0, tpf * 10);
            } else if (name.equals("direita")) {
                player.move(0, 0, tpf * -10);
            }
        }
    };

    @Override
    public void simpleUpdate(float tpf) {
        //TODO: add update code
    }

    @Override
    public void simpleRender(RenderManager rm) {
        //TODO: add render code
    }

    public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
    }

    public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
    }
}

Looks like a security issue.
What version of java do you use?
Any reason you’re using an applet? i mean are you sharing data between the web page and the java app?
Because I really encourage you to choose another way to deploy your app ( GetDown for example), because making an applet work became a nightmare with java 8 ( have to be signed with a valid certificate, no more self signed apps).
Moreover, Google gave up the support of the NPAPI in Chrome (the API used to start applets, flash and all that stuff that is from the beginning of the internet). Firefox seems to be on the same trend, and I guess it’s just going to disappear in a near future from any browser on the market.
So basing your deployment strategy on applets today is a bit risky IMO.

+1 on that, Applets are being phased out just as we speak.

Im using the latest version of Java, Java 8 i guess.

Well, i need to deploy as an applet because its going to be part of a Web browser Game, the type of game you dont need to download anything. And i’ll need to share data between the page and the app.

If apples are being phased out, there most be some kind of way to work on embed resources at web pages.

Jep. Using HTML 5 or that jnlp Web start (the latter is downloading the jar though).

It’s due to (reasonable) security concerns. In my opinio, Web pages should be interpreted only as there are plenty of security risks without.

I heard a Talk about a Java Script ddoser. They bought something like Google adsense which allows you to execute js, so every time the ad was visible, the Code ddosed the Page.

Applets are effectively downloaded :wink:
Maybe you want to use just HTML5 and javascript?

However yes, applet are phased out. I stopped supporting them several years ago because they gave me too much headaches :frowning:

Applets also download everything on the client…
Webstart will have the same security issue.

Again, you should change your strategy if you hope to efficiently distribute your game. Applets are on their way out of the internet. And that could be a lot faster than you expect.

HTML5 is the “official” replacement, but JME doesn’t support it, I’m sorry.
Note that…you also download everything on the client with HTML5 apps. And especially all the assets… that are the most bandwidth greedy.

That’s why I was talking about getdown. i’m not an expert with it, but all the cool kids seems to be fond of it.

Is Unity 5 a good replacement?

Well they do have a web renderer.
Now of course I’m reluctant to advise you to use another egine because I’m biased toward JME, but I guess that yes, that’s a solid alternative.

Though their browser plugin won’t get much love further down the road either. But imo games in browsers don’t deserve love anyway ^^

You don’t want your user to download anything and then you ask them to install a 3rd party plugin which is likely to be used only by your game?

At this point, you could make a favor to both you and your user and either:

  1. make a fully fledged desktop game
  2. use WebGL only