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) {
}
}