AppletLoader could use some clarification and better example

Started by ColacX, July 20, 2010, 13:10:06

Previous topic - Next topic

ColacX

Hi there im new to lwjgl and im looking at the AppletLoader and the html code is confusing me, its hard to get started when i dont know what exactly to replace.

the tutorial here seems to be out of date
http://lwjgl.org/wiki/doku.php/lwjgl/tutorials/applet#using_lwjgl_with_applets

"
https://sourceforge.net/project/showfiles.php?group_id=58488
From the package get the following files:
appletloader.html
jinput.jar
linux_natives.jar
lwjgl.jar
lwjgl_util_applet.jar
macosx_natives.jar
windows_natives.jar
"

not true i can only find two of the files from there

looking at the html-source from this page
http://www.lwjgl.org/applet/

it says
    <!-- signed windows natives jar in a jar -->
   <param name="al_windows" value="windows_natives.jar.lzma">
   
   <!-- signed linux natives jar in a jar -->
   <param name="al_linux" value="linux_natives.jar.lzma">
   
   <!-- signed mac osx natives jar in a jar -->
   <param name="al_mac" value="macosx_natives.jar.lzma">

   <!-- signed solaris natives jar in a jar -->
   <param name="al_solaris" value="solaris_natives.jar.lzma">

where would you get this windows_natives.jar.lzma? what is a .lzma file anyway?

would be grateful for some quickstart help

bobjob

the lzma files should be included with the LWJGL_applet download

ColacX

Quote from: bobjob on July 20, 2010, 13:24:57
the lzma files should be included with the LWJGL_applet download
oh missed that there was multiple downloads in that link k thanks. im so stupid for pressing the big green button ^^

ColacX

Hi there so i modified the appletloader.html as instructed
the lwjgl loading screen shows but stops when i get this error:

This occurred while 'Determining packages to load'

java.security.AccessControlException: access denied (java.util.PropertyPermission java.io.tmpdir read)
   at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
   at java.security.AccessController.checkPermission(AccessController.java:546)
   at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
   at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1285)
   at java.lang.System.getProperty(System.java:650)
   at org.lwjgl.util.applet.AppletLoader$2.run(AppletLoader.java:683)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.lwjgl.util.applet.AppletLoader.run(AppletLoader.java:671)
   at java.lang.Thread.run(Thread.java:619)

my jar file is called JavaOpenGLTestApplet

all the files needed should be there in the same folder as the appletloader.html file. im running this locally by doubleclicking the html file (i think this should work just fine right?)

no pressable security dialog showed up (i belive its supposed show do you trust this publisher dialog)

help please

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>AppletLoader</title>
  </head>
  <body>

  <applet code="org.lwjgl.util.applet.AppletLoader" archive="JavaOpenGLTestApplet.jar, lwjgl_util_applet.jar, lzma.jar" codebase="." width="640" height="480">
  
    <!-- The following tags are mandatory -->
    
    <!-- Name of Applet, will be used as name of directory it is saved in, and will uniquely identify it in cache -->
    <param name="al_title" value="JavaOpenGLTestApplet">
    
    <!-- Main Applet Class -->
    <param name="al_main" value="JavaOpenGLTestApplet">
    
    <!-- logo to paint while loading, will be centered -->
    <param name="al_logo" value="appletlogo.png">
    
    <!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done -->
    <param name="al_progressbar" value="appletprogress.gif">
    
    <!-- List of Jars to add to classpath -->
    <param name="al_jars" value="JavaOpenGLTestApplet.jar, lwjgl_applet.jar.pack.lzma, lwjgl.jar.pack.lzma, jinput.jar.pack.lzma, lwjgl_util.jar.pack.lzma, res.jar.lzma">
    
    <!-- signed windows natives jar in a jar --> 
    <param name="al_windows" value="windows_natives.jar.lzma">
    
    <!-- signed linux natives jar in a jar --> 
    <param name="al_linux" value="linux_natives.jar.lzma">
    
    <!-- signed mac osx natives jar in a jar --> 
    <param name="al_mac" value="macosx_natives.jar.lzma">

    <!-- signed solaris natives jar in a jar --> 
    <param name="al_solaris" value="solaris_natives.jar.lzma">
    
    <!-- Tags under here are optional -->
    
    <!-- Version of Applet, important otherwise applet won't be cached, version change will update applet, must be int or float -->
    <!-- <param name="al_version" value="0.1"> -->
    
    <!-- whether to use cache - defaults to true -->
    <!-- <param name="al_cache" value="true"> -->
    
    <!-- background color to paint with, defaults to white -->
    <!-- <param name="boxbgcolor" value="#000000"> -->
    
    <!-- foreground color to paint with, defaults to black -->
    <!-- <param name="boxfgcolor" value="#ffffff"> -->
    
    <!-- whether to run in debug mode -->
    <!-- <param name="al_debug" value="true"> -->
    
    <!-- whether to prepend host to cache path - defaults to true -->
    <!-- <param name="al_prepend_host" value="true"> -->
    
    <!-- main applet specific params -->
    
  	<param name="separate_jvm" value="true">
  </applet>

  <p>
    if <code>al_debug</code> is true the applet will load and extract resources with a delay, to be able to see the loader process.
  </p>

  </body>
</html>

bobjob

the AccessControlException probably came from not using signed jar files.

the method was called from an unsigned jar.
System.getProperty("java.io.tmpdir");

If thats not in your code, then the lwjgl jars are not signed
If you used the files contained in the lwjgl_applet download you shouldn't need to sign the applet.


ColacX

Quote from: bobjob on July 20, 2010, 14:32:06
the AccessControlException probably came from not using signed jar files.

the method was called from an unsigned jar.
System.getProperty("java.io.tmpdir");

If thats not in your code, then the lwjgl jars are not signed
If you used the files contained in the lwjgl_applet download you shouldn't need to sign the applet.

Huh which exact jar is unsigned? my own selfmade jarfile is obviously not signed
other jarfiles are:
lwjgl_util_applet.jar, lzma.jar
they are probably signed i got them from the downloads

i noticed that in this line:
<param name="al_jars" value="JavaOpenGLTestApplet.jar, lwjgl_applet.jar.pack.lzma, lwjgl.jar.pack.lzma, jinput.jar.pack.lzma, lwjgl_util.jar.pack.lzma, res.jar.lzma">
i added a jarfile while the rest is a .jar.pack.lzma file i dont know what thoose files are or how to make them could this be the problem?

actually you can clearly see that the exception came from AppletLoader$2.run method

bobjob

did the gears demo work?
the one that came with the lwjgl_applet download (appletLoader.html)

if so then the jars are signed. if not you will need to get a copy of signed jars, or sign them yourself.

kappa

just an observation if you put 'JavaOpenGLTestApplet.jar' in the al_jars parameter then you do not put it in the archive parameter in the applet tag.

ColacX

Quote from: bobjob on July 20, 2010, 18:50:19
did the gears demo work?
the one that came with the lwjgl_applet download (appletLoader.html)

if so then the jars are signed. if not you will need to get a copy of signed jars, or sign them yourself.
Ah i had copied files from the normal package with the same name that arent signed apperently only the jar files from the applet package are signed

the gears demo is working
but when i try my testjar it gets stuck on "Switching applet"

also tried compiling the GearsApplet.java found from the src-package and make a jar file from it and run it also gets stuck on "Switchin applet"

bobjob

the main function of the switch applet method was to load the class.
so its probably a "class not found exception".

maybe go over your package/class names and make sure they're accurate in the html file.

and like javalwjgl (or do you prefer kapta ;D) said, only include JavaOpenGLTestApplet.jar in the al_jars param.

ColacX

Quote from: bobjob on July 20, 2010, 19:53:37
the main function of the switch applet method was to load the class.
so its probably a "class not found exception".

maybe go over your package/class names and make sure they're accurate in the html file.

and like javalwjgl (or do you prefer kapta ;D) said, only include JavaOpenGLTestApplet.jar in the al_jars param.

Yes thank you it works now indeed i got an exception could see it when i looked in the console. I forgot to fix the package name in the GearsApplet.java, the rest is just OpenGL code now thanks.

Final html file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>AppletLoader</title>
  </head>
  <body>

  <applet code="org.lwjgl.util.applet.AppletLoader" archive="lwjgl_util_applet.jar, lzma.jar" codebase="." width="640" height="480">

    <!-- The following tags are mandatory -->

    <!-- Name of Applet, will be used as name of directory it is saved in, and will uniquely identify it in cache -->
    <param name="al_title" value="TEST7">

    <!-- Main Applet Class -->
    <param name="al_main" value="gearstestpackage.GearsApplet">

    <!-- logo to paint while loading, will be centered -->
    <param name="al_logo" value="appletlogo.png">

    <!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done -->
    <param name="al_progressbar" value="appletprogress.gif">

    <!-- List of Jars to add to classpath -->
    <param name="al_jars" value="JavaOpenGLTestApplet.jar, lwjgl_applet.jar.pack.lzma, lwjgl.jar.pack.lzma, jinput.jar.pack.lzma, lwjgl_util.jar.pack.lzma, res.jar.lzma">

    <!-- signed windows natives jar in a jar -->
    <param name="al_windows" value="windows_natives.jar.lzma">

    <!-- signed linux natives jar in a jar -->
    <param name="al_linux" value="linux_natives.jar.lzma">

    <!-- signed mac osx natives jar in a jar -->
    <param name="al_mac" value="macosx_natives.jar.lzma">

    <!-- signed solaris natives jar in a jar -->
    <param name="al_solaris" value="solaris_natives.jar.lzma">

    <!-- Tags under here are optional -->

    <!-- Version of Applet, important otherwise applet won't be cached, version change will update applet, must be int or float -->
    <!-- <param name="al_version" value="0.1"> -->

    <!-- whether to use cache - defaults to true -->
    <!-- <param name="al_cache" value="true"> -->

    <!-- background color to paint with, defaults to white -->
    <!-- <param name="boxbgcolor" value="#000000"> -->

    <!-- foreground color to paint with, defaults to black -->
    <!-- <param name="boxfgcolor" value="#ffffff"> -->

    <!-- whether to run in debug mode -->
    <!-- <param name="al_debug" value="true"> -->

    <!-- whether to prepend host to cache path - defaults to true -->
    <!-- <param name="al_prepend_host" value="true"> -->

    <!-- main applet specific params -->

  	<param name="separate_jvm" value="true">
  </applet>

  <p>
    if <code>al_debug</code> is true the applet will load and extract resources with a delay, to be able to see the loader process.
  </p>

  </body>
</html>


package gearstestpackage;