Hello Guest

LWJGL Applet

  • 10 Replies
  • 14851 Views
LWJGL Applet
« on: June 10, 2012, 16:44:33 »
I'm testing exporting my game to put up online, and I'm running into some kind of difficulty with the applet loader.

Here's my Applet Code:
Code: [Select]
<html>
<head>
</head>
<body>
<applet code="org.lwjgl.util.applet.AppletLoader"
        archive="lwjgl_util_applet.jar"
        codebase="."
        width="960" height="640">
<param name="al_title" value="DemonCycle">
<param name="al_jars" value="lwjgl.jar, slick-util.jar, lwjgl_util.jar, game.jar">
<param name="al_main" value="DemonCycle.GameApplet">
<param name="al_windows" value="windows_natives.jar">
<param name="al_linux" value="linux_natives.jar">
<param name="al_mac" value="macosx_natives.jar">
</applet>
</body>
</html>

And here's the GameApplet file it points to:
Code: [Select]
package DemonCycle;

import java.applet.Applet;

@SuppressWarnings("serial")
public class GameApplet extends Applet{

//Fields
private Game game;

//Constructor
//No Constructor

public void init(){
try {
game = new Game();
game.setSize(getWidth(),getHeight());
add(game);
game.setFocusable(true);
game.requestFocus();
game.setIgnoreRepaint(true);
setVisible(true);

} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Unable to create display!");
}
}


public void start(){

}

public void stop() {

}

public void destroy() {
remove(game);
super.destroy();
}

}

All of the OpenGL Initializing code is in the Game class which extends the Canvas class.  The applet runs fine in Eclipse, but when I use the Applet Loader, I get a super quick flash of the loading screen and then nothing.  Am I missing something?  Everything's signed.

Thanks again.  You guys are incredibly helpful.

Re: LWJGL Applet
« Reply #1 on: June 10, 2012, 16:49:05 »
What do you get in the java console? Is it online somewhere to be tested? the LWJGL files are signed already, did you sign them twice now? :) You only have to worry about signing if you need it for your applet.

Mike

Re: LWJGL Applet
« Reply #2 on: June 11, 2012, 03:10:07 »
Okay, after setting up the console in Firefox, here's the exception I'm getting:

Code: [Select]
Exception in thread "Thread-13" java.lang.UnsatisfiedLinkError: /home/name/.java/deployment/cache/lwjglcache/(Website)/DemonCycle/natives/liblwjgl.so: /home/name/.java/deployment/cache/lwjglcache/(Website)/DemonCycle/natives/liblwjgl.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1928)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
at java.lang.Runtime.load0(Runtime.java:792)
at java.lang.System.load(System.java:1059)
at org.lwjgl.Sys$1.run(Sys.java:70)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:95)
at org.lwjgl.Sys.<clinit>(Sys.java:112)
at org.lwjgl.opengl.Display.<clinit>(Display.java:135)
at DemonCycle.Game$1.run(Game.java:62)

*

Offline kappa

  • *****
  • 1319
Re: LWJGL Applet
« Reply #3 on: June 11, 2012, 09:09:49 »
What version of LWJGL are you using? Do make sure you are using the latest version (2.8.4). Also which OS, Java version and arch (32bit, 64bit, ppc, etc) are you on?

Re: LWJGL Applet
« Reply #4 on: June 11, 2012, 17:16:57 »
Hi,

i also have a problem with the applet preloader. I want to use the loader with jDosbox. http://sourceforge.net/projects/jdosbox/
It works perfect with Windows 7 x64 (jre + jdk 7 x86 & jre x64) and on Arch Linux x64 with latest Java 7.4 installed.

But on Ubuntu (LUbuntu distro) x64 with openjdk 6+7 and IcedTea-web-start it doesn't work. The Basic LWJGL Demo loads but then doesn't display anything.
Same happens on Arch Linux with openjdk.

This is the html code for launching jDosbox.jar. With Openjdk it does not use the last two parameters for jDosbox.

Code: [Select]
<html>
  <head>
    <title>AppletLoader</title>
  </head>
  <body>
    <applet code="org.lwjgl.util.applet.AppletLoader" archive="lwjgl_util_applet.jar" codebase="." width="640" height="480">
    <param name="al_title" value="appletloadertest">
    <param name="al_main" value="jdos.gui.MainApplet">

    <param name="al_jars" value=" jdosbox.jar">
    <param name="al_windows" value="jdosbox.jar">
    <param name="al_linux" value="jdosbox.jar">
    <param name="al_mac" value="jdosbox.jar">
    <param name="al_solaris" value="jdosbox.jar">

   <param name="download1" value="http://"pathtodataonweb"/DATA.zip">
   <param name="param1" value="-conf ~/.jdosbox/DATA/dosbox.conf">

  </body>

</html>

The Applet Loader seems to be broken with Openjdk. Maybe this is helpful to solve the Problem. I tried this with LWJGL 2.8.4 and 2.8.5 nightly.

*

Offline kappa

  • *****
  • 1319
Re: LWJGL Applet
« Reply #5 on: June 11, 2012, 17:25:55 »
is it possible you can provide the output/exception from the java console? (if its not enabled please enable it from the java/IcedTea control panel) Without the exception its pretty hard to tell what is going wrong.
« Last Edit: June 11, 2012, 17:56:48 by kappa »

Re: LWJGL Applet
« Reply #6 on: June 11, 2012, 17:58:50 »
Console Code for BASIC LWJGL DEMO:

Code: [Select]
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu3)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.lwjgl.util.applet.AppletLoader$4.getPermissions(AppletLoader.java:1202)
at java.security.SecureClassLoader.getProtectionDomain(SecureClassLoader.java:210)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at org.lwjgl.util.applet.AppletLoader.switchApplet(AppletLoader.java:1315)
at org.lwjgl.util.applet.AppletLoader$2.run(AppletLoader.java:909)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:216)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:647)
at java.awt.EventQueue.access$000(EventQueue.java:96)
at java.awt.EventQueue$1.run(EventQueue.java:608)
at java.awt.EventQueue$1.run(EventQueue.java:606)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:105)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:617)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
Caused by: java.lang.NullPointerException
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getPermissions(JNLPClassLoader.java:915)
... 30 more
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.lwjgl.util.applet.AppletLoader$4.getPermissions(AppletLoader.java:1202)
at java.security.SecureClassLoader.getProtectionDomain(SecureClassLoader.java:210)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2406)
at java.lang.Class.getConstructor0(Class.java:2716)
at java.lang.Class.newInstance0(Class.java:343)
at java.lang.Class.newInstance(Class.java:325)
at org.lwjgl.util.applet.AppletLoader.switchApplet(AppletLoader.java:1316)
at org.lwjgl.util.applet.AppletLoader$2.run(AppletLoader.java:909)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:216)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:647)
at java.awt.EventQueue.access$000(EventQueue.java:96)
at java.awt.EventQueue$1.run(EventQueue.java:608)
at java.awt.EventQueue$1.run(EventQueue.java:606)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:105)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:617)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
Caused by: java.lang.NullPointerException
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getPermissions(JNLPClassLoader.java:915)
... 35 more
Exception in thread "Thread-11" java.lang.ExceptionInInitializerError
at org.lwjgl.Sys.createImplementation(Sys.java:124)
at org.lwjgl.Sys.<clinit>(Sys.java:111)
at org.lwjgl.opengl.Display.<clinit>(Display.java:132)
at org.lwjgl.test.applet.GearsApplet$1.run(GearsApplet.java:55)
Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission org.lwjgl.util.Debug read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:393)
at java.security.AccessController.checkPermission(AccessController.java:553)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at net.sourceforge.jnlp.runtime.JNLPSecurityManager.checkPermission(JNLPSecurityManager.java:284)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1302)
at java.lang.System.getProperty(System.java:669)
at java.lang.Boolean.getBoolean(Boolean.java:238)
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.<clinit>(LWJGLUtil.java:265)
... 4 more
Disposal was interrupted:
java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:502)
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1040)
at java.awt.Window.doDispose(Window.java:1071)
at java.awt.Window.dispose(Window.java:1014)
at sun.applet.PluginAppletViewer.destroyApplet(PluginAppletViewer.java:630)
at sun.applet.PluginAppletViewer.handleMessage(PluginAppletViewer.java:533)
at sun.applet.PluginStreamHandler.handleMessage(PluginStreamHandler.java:232)
at sun.applet.PluginMessageHandlerWorker.run(PluginMessageHandlerWorker.java:78)
Clear up

Console Code for jDosbox: (it loads the Applet but ignores Parameters)

Code: [Select]
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu3)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.lwjgl.util.applet.AppletLoader$4.getPermissions(AppletLoader.java:1202)
at java.security.SecureClassLoader.getProtectionDomain(SecureClassLoader.java:210)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at org.lwjgl.util.applet.AppletLoader.switchApplet(AppletLoader.java:1315)
at org.lwjgl.util.applet.AppletLoader$2.run(AppletLoader.java:909)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:216)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:647)
at java.awt.EventQueue.access$000(EventQueue.java:96)
at java.awt.EventQueue$1.run(EventQueue.java:608)
at java.awt.EventQueue$1.run(EventQueue.java:606)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:105)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:617)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
Caused by: java.lang.NullPointerException
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getPermissions(JNLPClassLoader.java:915)
... 30 more
Applet.init()
Applet is not signed
    mouse capture will not work
    disabling compiler
Applet.start
About to start DosBox
download parameter should be the url of a .zip or .7z file
java.security.AccessControlException: access denied (java.lang.RuntimePermission getenv.USERPROFILE)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:393)
at java.security.AccessController.checkPermission(AccessController.java:553)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at net.sourceforge.jnlp.runtime.JNLPSecurityManager.checkPermission(JNLPSecurityManager.java:284)
at java.lang.System.getenv(System.java:846)
at jdos.a.g.d(Unknown Source)
at jdos.gui.MainApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:679)
DOSBox version 0.74.25e_svn
Copyright 2002-2010 DOSBox Team, published under GNU GPL.
---
java.security.AccessControlException: access denied (java.lang.RuntimePermission getenv.USERPROFILE)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:393)
at java.security.AccessController.checkPermission(AccessController.java:553)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at net.sourceforge.jnlp.runtime.JNLPSecurityManager.checkPermission(JNLPSecurityManager.java:284)
at java.lang.System.getenv(System.java:846)
at jdos.a.g.d(Unknown Source)
at jdos.a.g.c(Unknown Source)
at jdos.j.a.a(Unknown Source)
at jdos.g.a.b.d(Unknown Source)
at jdos.gui.a.a(Unknown Source)
at jdos.gui.MainApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:679)
DOSBOX_RealInit
About to allocate memory 11279kb: 45192kb free
HARDWARE_Init not finished yet: NO SCREEN SHOTS
javax.sound.sampled.LineUnavailableException
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openImpl(PulseAudioMixer.java:714)
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openLocal(PulseAudioMixer.java:588)
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openLocal(PulseAudioMixer.java:584)
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.open(PulseAudioMixer.java:579)
at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.open(PulseAudioDataLine.java:94)
at org.classpath.icedtea.pulseaudio.PulseAudioSourceDataLine.open(PulseAudioSourceDataLine.java:75)
at jdos.e.bT.b(Unknown Source)
at jdos.e.bT.a(Unknown Source)
at jdos.e.bY.a(Unknown Source)
at jdos.g.a.m.a(Unknown Source)
at jdos.g.a.b.a(Unknown Source)
at jdos.gui.a.a(Unknown Source)
at jdos.gui.MainApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:679)
javax.sound.midi.MidiUnavailableException: Can not open line
at com.sun.media.sound.SoftSynthesizer.open(SoftSynthesizer.java:1132)
at com.sun.media.sound.SoftSynthesizer.open(SoftSynthesizer.java:1036)
at jdos.gui.v.<init>(Unknown Source)
at jdos.gui.x.a(Unknown Source)
at jdos.g.a.m.a(Unknown Source)
at jdos.g.a.b.a(Unknown Source)
at jdos.gui.a.a(Unknown Source)
at jdos.gui.MainApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:679)
Caused by: javax.sound.sampled.LineUnavailableException
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openImpl(PulseAudioMixer.java:714)
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openLocal(PulseAudioMixer.java:588)
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.openLocal(PulseAudioMixer.java:584)
at org.classpath.icedtea.pulseaudio.PulseAudioMixer.open(PulseAudioMixer.java:579)
at org.classpath.icedtea.pulseaudio.PulseAudioDataLine.open(PulseAudioDataLine.java:94)
at org.classpath.icedtea.pulseaudio.PulseAudioSourceDataLine.open(PulseAudioSourceDataLine.java:75)
at com.sun.media.sound.SoftSynthesizer.open(SoftSynthesizer.java:1077)
... 8 more
MIDI:Opened device:Real Time Sequencer
DSP:Reset
Read from port 378
Read from port 379
Read from port 3bc
Read from port 3be
Read from port 278
Read from port 279
INT10_Init
Invalid type for serial1
Invalid type for serial2
Network card disabled
Parsing command line: AUTOEXEC.BAT
Special file open command 80 file Z:\AUTOEXEC.BAT
Special file open command 80 file Z:\AUTOEXEC.BAT
Parsing command line: SET BLASTER=A220 I7 D1 H5 T6
Special file open command 80 file Z:\AUTOEXEC.BAT
Startup time: 76ms
Disposal was interrupted:
java.lang.InterruptedException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:502)
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1040)
at java.awt.Window.doDispose(Window.java:1071)
at java.awt.Window.dispose(Window.java:1014)
at sun.applet.PluginAppletViewer.destroyApplet(PluginAppletViewer.java:630)
at sun.applet.PluginAppletViewer.handleMessage(PluginAppletViewer.java:533)
at sun.applet.PluginStreamHandler.handleMessage(PluginStreamHandler.java:232)
at sun.applet.PluginMessageHandlerWorker.run(PluginMessageHandlerWorker.java:78)
Applet.stop
Normal Shutdown
DSP:Reset

EDIT: forgot pulseaudio and i installed it but has the same result
« Last Edit: June 11, 2012, 18:14:28 by DiViNiTY »

*

Offline Matzon

  • *****
  • 2242
Re: LWJGL Applet
« Reply #7 on: June 11, 2012, 19:43:45 »
IMO, looks like a bug in openjdk

*

Offline kappa

  • *****
  • 1319
Re: LWJGL Applet
« Reply #8 on: June 11, 2012, 20:07:02 »
@DiViNiTY - Yup, that is a known problem with the IcedTea-Web plugin. It happens because their security model isn't fully implemented yet. Its due to be fixed in the IcedTea-Web 2.0 release as mentioned here.

In the mean time you can install the Oracle Java plugin and it should work fine.
« Last Edit: June 11, 2012, 20:11:39 by kappa »

Re: LWJGL Applet
« Reply #9 on: June 11, 2012, 20:19:59 »
ok, thanks for the information.

Re: LWJGL Applet
« Reply #10 on: June 11, 2012, 22:24:03 »
I'm running Ubuntu 12.04 64 bit with 64 bit Oracle Java 7 in Firefox 13.

Initially I've been working on the game in 2.8.3, because 2.8.4 just wasn't out yet.  When switching to the 2.8.4 library, everything seems to work now.  I have an unrelated bug to fix now, but I can at least see it.

Thanks.