SimpleJMEApplet tutorial problem

Hello guys, I’ve been trying to run a SimpleJMEApplet example in my browser, I used this tutorial… The example runs fine on NetBeans, but when I try to run it on browser (either firefox or IE), I get this error:



18/10/2010 07:54:39 com.jme.system.lwjgl.LWJGLDisplaySystem

INFO: LWJGL Display System created.

Exception in thread “thread applet-br.unisc.AppletTestBoxColor-1” java.lang.ExceptionInInitializerError

at org.lwjgl.Sys.createImplementation(Sys.java:109)

at org.lwjgl.Sys.(Sys.java:97)

at org.lwjgl.opengl.AWTGLCanvas.(AWTGLCanvas.java:84)

at com.jmex.awt.lwjgl.LWJGLAWTCanvasConstructor.makeCanvas(LWJGLAWTCanvasConstructor.java:45)

at com.jmex.awt.lwjgl.LWJGLAWTCanvasConstructor.makeCanvas(LWJGLAWTCanvasConstructor.java:42)

at com.jme.system.lwjgl.LWJGLDisplaySystem.createCanvas(LWJGLDisplaySystem.java:212)

at com.jme.system.lwjgl.LWJGLDisplaySystem.createCanvas(LWJGLDisplaySystem.java:189)

at com.jmex.awt.applet.SimpleJMEApplet.init(SimpleJMEApplet.java:156)

at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)

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 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.(LWJGLUtil.java:268)

… 10 more



I use this html file:

[java]

html>

head> Meu Applet /head>

body>

h1>MyApplet Page/h1>

center>

applet

code=“br.unisc.AppletTestBoxColor”

archive=“lwjgl_util_applet.jar,lwjgl.jar,jme.jar,jme-awt.jar,signedgame.jar”

width=“800” height=“600”>

param name=“useAppletCanvasSize” value=“true”/>

/applet>

/center>

/body>

/html>

[/java]

then I have the AppletTestBoxColor.class file inside the br/unisc/ directory

and all the JARs mentioned in the ‘archive’ parameter in the same folder of the html file…

That error just implies that your jars are not signed properly. As they are not signed the permissions to the jme jars are denied by java and hence you get the above error.



Also AWTGLCanvas used above is very old way to run lwjgl applets, pretty sure there another class somewhere in JME that uses the new Display.setParent method to run applets.

1 Like

i already signed the ‘signedgame.jar’ (the jar where my applet is)… so, I dont think that’s the reason… :confused:



I will look into Display.setParent…

Theres new security settings in WebStart now, you will have to use lwjgl 2.5 and the supplied Applet Harness.

1 Like
normen said:
Theres new security settings in WebStart now, you will have to use lwjgl 2.5 and the supplied Applet Harness.

hmmm, sorry for my silliness, but... how can I do it? X(
What is Applet Harness?
I'm not using webstart... Is that a problem?
I'm already using lwjgl 2.5
tauame said:
hmmm, sorry for my silliness, but... how can I do it? X(
What is Applet Harness?

I think he's referring to the LWJGL AppletLoader, there is a full tutorial on what it is and how to use it here.

hmmmmm thx, i will take a look over it, if it works, I tell u guys :wink:

hello again… I tried to fix my errors here. Well… i did, but the applet still not running and now it doesnt report any errors…

I’m using lwjgl 2.6 now, and I used the lwjgl AppletLoader. I also signed all my jars.



Here is what is happening: The applet loader loads the applet (it shows the applet loader loading screen) and when it finishes i just get a blank screen.



Here is the java console output:

Imagem carregada: file:/C:/Documents%20and%20Settings/Tauame/Meus%20documentos/NetBeansProjects/AppletGame/build/logo.png

Imagem carregada: file:/C:/Documents%20and%20Settings/Tauame/Meus%20documentos/NetBeansProjects/AppletGame/build/barraprogresso.gif

21/10/2010 10:30:41 com.jme.system.lwjgl.LWJGLDisplaySystem

INFO: LWJGL Display System created.



(the first 2 lines means “Image loaded: <path…>”)



what could it be? :frowning:

can you paste the html code you are using with the appletloader?

sure…

how can i paste it, so it doenst be recognized by the browser?

Use blockquote tags, the code tags remove tags in the code atm…

ok, thanks, here it is


[java]
<html>
<head> Meu Applet </head>
<body>
<h1>MyApplet Page</h1>
<center>
<applet code="org.lwjgl.util.applet.AppletLoader"
archive="lwjgl_util_applet.jar"
codebase="."
width="640" height="480">

<param name="al_title" value="appletgame">
<param name="al_jars" value="lwjgl.jar,jme.jar,jme-awt.jar,AppletGame.jar">
<param name="al_main" value="br.unisc.AppletTestBoxColor">

<param name="al_logo" value="logo.png">
<param name="al_progressbar" value="barraprogresso.gif">

<param name="al_windows32" value="windows32_natives.jar">
<param name="al_windows64" value="windows64_natives.jar">

<param name="al_linux32" value="linux32_natives.jar">
<param name="al_linux64" value="linux64_natives.jar">

<param name="al_mac" value="macosx_natives.jar">
</applet>
</center>
</body>
</html>
[/java]

Ok, I replaced all < signs with & lt;

ops, it didnt work

i used

blockquote>

htmlcode

/blockquote>

hmm, the html above looks pretty much correct, still pretty odd that nothing is thrown in the console.



Could you put a few System.out.println()'s in your code?, so as to narrow down how far the applet gets before it freezes/stops. Might be a case of exceptions getting caught and not thrown again.



Alternatively you could upload it somewhere, to allow a closer look at it.

hmmm… looks like my applet is not being called…



in the beggining of the simpleAppletSetup() method, i put this code:

System.out.println(“1”);



getLightState().setEnabled(false);

System.out.println(“2”);

rotQuat = new Quaternion();

System.out.println(“3”);



but it’s NOT being printed…

ok, in that case its likely freezing/stopping somewhere in JME code.



Which version of JME are you using? will have to have a look at the source code for SimpleJMEApplet.



Could your paste the code to your main applet class too?



thanks

Oh, just had a look at the code for SimpleJMEApplet and it seems like SimpleJMEApplet uses the old AWTGLCanvas.



The better class to use seems to be SimpleApplet which uses the new LWJGL Display.setParent method.



Try SimpleApplet to see if it works better for you.

hmmm… interesting… i will try this SimpleApplet tomorrow morning. Thanks a lot :smiley:

Hi guys, I’m back. I decided to go for BaseSimpleApplet instead of SimpleApplet (both uses Display.setParent method)… but there is a weird thing happening… when I run the applet, it calls the simpleInitGame method, but doesn’t calls the simpleUpdate :confused:



[java]

public class AppletTestBoxColor extends BaseSimpleApplet {



Canvas display_parent;

private TriMesh t;

private Quaternion rotQuat;

private float angle = 0;

private Vector3f axis;



@Override

protected void simpleInitGame() {

try {

Display.setParent(display_parent);

} catch (LWJGLException ex) {

ex.printStackTrace();

}





lightState.setEnabled(false);

rotQuat = new Quaternion();



axis = new Vector3f(1, 1, 0.5f).normalizeLocal();



Vector3f max = new Vector3f(5, 5, 5);

Vector3f min = new Vector3f(-5, -5, -5);



t = new Box(“Box”, min, max);

t.setModelBound(new BoundingBox());

t.updateModelBound();

t.setLocalTranslation(new Vector3f(0, 0, -15));

rootNode.attachChild(t);



t.setRandomColors();



TextureState ts = display.getRenderer().createTextureState();

ts.setEnabled(true);

ts.setTexture(TextureManager.loadTexture(

TestBoxColor.class.getClassLoader().getResource(

“Monkey.png”), Texture.MinificationFilter.Trilinear,

Texture.MagnificationFilter.Bilinear));



rootNode.setRenderState(ts);

}



@Override

protected void simpleUpdate() {

if (tpf < 1) {

angle = angle + (tpf * 25);

if (angle > 360) {

angle -= 360;

}

}



rotQuat.fromAngleNormalAxis(angle * FastMath.DEG_TO_RAD, axis);

t.setLocalRotation(rotQuat);

System.out.println(“THIS IS NOT BEING PRINTED”);

}



}

[/java]