JOGL in an applet

Hello, I’m making a very simple example baout how to make animations with jogl. My aim is to show it embedded in a web page. The example is in the package CubeAnimation, the class needed are MyApplet, MyWidget(GLCanvas) and MyGLListener. This is the code that I’m using for the html page:


<html>

<applet code="org.jdesktop.applet.util.JNLPAppletLauncher"
	  
      width=600
      height=400
      archive="http://download.java.net/media/applet-launcher/applet-launcher.jar,
               http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar,
               http://download.java.net/media/gluegen/webstart/gluegen-rt.jar,
               CubeAnimation.jar"
   <param name="codebase_lookup" value="true">
   <param name="subapplet.classname" value="CubeAnimation.MyApplet">
   <param name="subapplet.displayname" value="Cube Animation">
   <param name="noddraw.check" value="true">
   <param name="progressbar" value="true">
   <param name="jnlpNumExtensions" value="1">
   <param name="jnlpExtension1"
          value="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp">
</applet>

</html>



By now I have no JOGL installation on my PC.
The applet hangs befor call MyGLListener.init(). My applet works I have jogl installed on my PC, that’s what i’m doing on Linux. But if I don’t use JNLPAppletLauncher it doesn’t work, I want it can work in an JOGL-agnostic PC(like my windows one).

Help please:(

Your applet tag looks correct. Try enabling the Java Console in the Java Control Panel, doing a thread dump when the applet hangs and see what appears to be happening. It’s possible your applet threw an exception which is what’s causing it to fail.

Hello

Iadded some static blocks and the classes are loaded. I also modify the constructors and add some messages tp show when the classes be instantied. Everything looks fine. But after a MyGLWidget is creaed, nothing else happen.

JNLPAppletLauncher: static initializer
os.name = windows xp
nativePrefix = nativeSuffix = .dll
tmpRootDir = C:\DOCUME~1\Huertas\CONFIG~1\Temp\jnlp-applet\jln12652
Applet.init
subapplet.classname = CubeAnimation.MyApplet
subapplet.displayname = Cube Animation
Applet.start
Exception in thread “Thread-6” java.lang.NullPointerException
at sun.plugin.util.AnimationPanel.createTranslucentImage(Unknown Source)
at sun.plugin.util.AnimationPanel.createGradientShapeImage(Unknown Source)
at sun.plugin.util.AnimationPanel.initBackground(Unknown Source)
at sun.plugin.util.AnimationPanel.preloadResources(Unknown Source)
at sun.plugin.util.AnimationPanel.doPaint(Unknown Source)
at sun.plugin.util.AnimationPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
os.name = windows xp
os.arch = x86
processNativeJar: using previously cached: C:\Documents and Settings\Huertas.jnlp-applet\cache\UNKNOWN\e4bbdfd5ed1ed6f5af6ccc796f472c706266940c\jogl-natives-windows-i586.jar
validateCertificates:
VALIDATE: jogl.dll
VALIDATE: jogl_awt.dll
VALIDATE: jogl_cg.dll
extractNativeLibs:
EXTRACT: jogl.dll(jogl)
EXTRACT: jogl_awt.dll(jogl_awt)
EXTRACT: jogl_cg.dll(jogl_cg)
processNativeJar: using previously cached: C:\Documents and Settings\Huertas.jnlp-applet\cache\UNKNOWN\e4bbdfd5ed1ed6f5af6ccc796f472c706266940c\gluegen-rt-natives-windows-i586.jar
validateCertificates:
VALIDATE: gluegen-rt.dll
extractNativeLibs:
EXTRACT: gluegen-rt.dll(gluegen-rt)
Se cargó la clase MyApplet
Se cargó la clase MyWidget
Se encontró la clase MyWidget
Se cargó la clase MyGLListener
Se encontró la clase MyGLListener
Se instancio la clase MyApplet
Dento del metodo ‘init’ de MyApplet
JNLPAppletLauncher.loadLibrary(“jogl”)
loading: C:\DOCUME~1\Huertas\CONFIG~1\Temp\jnlp-applet\jln12652\jln12653\jogl.dll
Dentro del constructor de la clase MyWidget
Se inicializo correctamente MyWidget
Se instancio la clase MyGLListener
Se inicializo MyApplet

I don’t think the problem be the first exception. In mi Linux pc(with jogl installed) i have the same exception, but then the applet works. The problem is between the constructor of the canvas and it’s first draw. :frowning: .

When nothing appears to be happening, press ‘v’ in the Java Console window and see what is displayed in the thread dump. It might be obvious if there is a deadlock among some threads.

Hello. I can`t understand what is the outpu of the console :-[. I just can post a little section ibeacuse it’s too long for this forum. I cna’t attach the files, I do’nt know why :(.

Volcar pila de subprocesos …

2007-11-19 19:55:47
Full thread dump Java HotSpot™ Client VM (1.6.0_03-b05 mixed mode):

“Timer-2” prio=4 tid=0x07b0b400 nid=0xce8 in Object.wait() [0x09a0f000…0x09a0fc14]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.util.TimerThread.mainLoop(Unknown Source)
- locked <0x215ee9b0> (a java.util.TaskQueue)
at java.util.TimerThread.run(Unknown Source)

“AWT-EventQueue-1” prio=6 tid=0x0788b400 nid=0xce0 waiting on condition [0x07c5f000…0x07c5fd14]
java.lang.Thread.State: RUNNABLE
at com.sun.deploy.util.ConsoleHelper.dumpAllStacksImpl(Native Method)
at com.sun.deploy.util.ConsoleHelper.dumpAllStacks(Unknown Source)
at sun.plugin.util.PluginConsoleController.dumpAllStacks(Unknown Source)
at com.sun.deploy.util.ConsoleWindow$2.actionPerformed(Unknown Source)
at javax.swing.JComponent$ActionStandin.actionPerformed(Unknown Source)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.KeyboardManager.fireBinding(Unknown Source)
at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
at javax.swing.JComponent.processKeyBindings(Unknown Source)
at javax.swing.JComponent.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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)

“AWT-EventQueue-4” prio=4 tid=0x065ed400 nid=0x458 in Object.wait() [0x0770f000…0x0770fd94]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at java.awt.EventQueue.getNextEvent(Unknown Source)
- locked <0x215eebe8> (a java.awt.EventQueue)
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)

“thread applet-org.jdesktop.applet.util.JNLPAppletLauncher” prio=4 tid=0x06556c00 nid=0x388 in Object.wait() [0x07d5f000…0x07d5fa94]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at sun.applet.AppletPanel.getNextEvent(Unknown Source)
- locked <0x215eecb0> (a sun.plugin.AppletViewer)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

“AWT-EventQueue-0” prio=6 tid=0x07883c00 nid=0x60c in Object.wait() [0x0750f000…0x0750fc94]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at java.awt.EventQueue.getNextEvent(Unknown Source)
- locked <0x213bde18> (a java.awt.EventQueue)
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)

“AWT-Shutdown” prio=6 tid=0x07882000 nid=0xcc4 in Object.wait() [0x06f0f000…0x06f0fd14]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at sun.awt.AWTAutoShutdown.run(Unknown Source)
- locked <0x213d5f80> (a java.lang.Object)
at java.lang.Thread.run(Unknown Source)

“TimerQueue” daemon prio=6 tid=0x065edc00 nid=0x534 in Object.wait() [0x0760f000…0x0760fb94]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at javax.swing.TimerQueue.run(Unknown Source)
- locked <0x2147b6d0> (a javax.swing.TimerQueue)
at java.lang.Thread.run(Unknown Source)

“ConsoleWriterThread” daemon prio=6 tid=0x065c7800 nid=0xf8 in Object.wait() [0x0729f000…0x0729fd14]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at com.sun.deploy.util.ConsoleTraceListener$ConsoleWriterThread.run(Unknown Source)
- locked <0x21419500> (a java.lang.Object)

“CacheCleanUpThread” daemon prio=6 tid=0x06576800 nid=0xab4 in Object.wait() [0x06c0f000…0x06c0fb94]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x21419698> (a com.sun.deploy.cache.CleanupThread)
at java.lang.Object.wait(Object.java:485)
at com.sun.deploy.cache.CleanupThread.run(Unknown Source)
- locked <0x21419698> (a com.sun.deploy.cache.CleanupThread)

“traceMsgQueueThread” daemon prio=6 tid=0x06568400 nid=0x70c in Object.wait() [0x06b0f000…0x06b0fc14]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at com.sun.deploy.util.Trace$TraceMsgQueueChecker.run(Unknown Source)
- locked <0x213d8f68> (a java.util.ArrayList)
at java.lang.Thread.run(Unknown Source)

“AWT-Windows” daemon prio=6 tid=0x06557800 nid=0xe9c runnable [0x06a0f000…0x06a0fc94]
java.lang.Thread.State: RUNNABLE
at sun.awt.windows.WToolkit.eventLoop(Native Method)
at sun.awt.windows.WToolkit.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

“Java2D Disposer” daemon prio=10 tid=0x06553c00 nid=0xed0 in Object.wait() [0x0680f000…0x0680fd94]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
- locked <0x213d6018> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
at sun.java2d.Disposer.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

“Low Memory Detector” daemon prio=6 tid=0x05c9f800 nid=0xebc runnable [0x00000000…0x00000000]
java.lang.Thread.State: RUNNABLE

“CompilerThread0” daemon prio=10 tid=0x05c9ac00 nid=0xeb8 waiting on condition [0x00000000…0x0630f71c]
java.lang.Thread.State: RUNNABLE

“Attach Listener” daemon prio=10 tid=0x05c99800 nid=0xeb4 runnable [0x00000000…0x00000000]
java.lang.Thread.State: RUNNABLE

“Signal Dispatcher” daemon prio=10 tid=0x05c98c00 nid=0xec0 runnable [0x00000000…0x00000000]
java.lang.Thread.State: RUNNABLE

“Finalizer” daemon prio=8 tid=0x05c87c00 nid=0x9a8 in Object.wait() [0x0600f000…0x0600fc94]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
- locked <0x213d6270> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(Unknown Source)
at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

“Reference Handler” daemon prio=10 tid=0x05c86800 nid=0xcac in Object.wait() [0x05f0f000…0x05f0fd14]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
- locked <0x213d5df8> (a java.lang.ref.Reference$Lock)

“main” prio=6 tid=0x0396a000 nid=0x820 runnable [0x00000000…0x0012f830]
java.lang.Thread.State: RUNNABLE

“VM Thread” prio=10 tid=0x05c82000 nid=0xca8 runnable

“VM Periodic Task Thread” prio=10 tid=0x05caa000 nid=0xec4 waiting on condition

Thread.State: RUNNABLE

“VM Thread” prio=10 tid=0x05c82000 nid=0xca8 runnable

“VM Periodic Task Thread” prio=10 tid=0x05caa000 nid=0xec4 waiting on condition


Terminado.

Nothing appears wrong from that thread dump.

My best recommendation is to try to simplify your applet or start from a working one like the Gears applet. If you still can’t figure out what is going wrong then make your sources available and maybe someone can help you look into the problem more deeply.

I’ll try with Gears applet first as you says. Thanks for your time :).

Hi! if you’re unsure about the source of the exception caught then please check for a correct reason or you might bypass some foolish typing errors ! NullPointerException can interrupt the running Thread as do other errors. ::slight_smile: