JOGL: Applets (part 1)

A Java Applet using JOGL may utilize 2 methods

Standard JNLP Applets are supported starting with Java 6u14, however, if you run MacOSX or an older version of  Java,
you may need to use the Applet-Launcher.

Below we utilize both, the standard JNLP mechanism of 6u14 as the default,
or falling back to our  Applet-Launcher.

You will find the JNLP file applet-gears.jnlp further below, which is being used in case of a JNLP launch,
otherwise it is ignored and the archive tags are being used, hence the applet-launcher will be started.

Note that it is important for the startup time to have the same JVM arguments in the applet tags,
as well as within the JNLP applet description, here see property sun.java2d.noddraw.
Only if JVM arguments of the JNLP applet description are satisfied by the applet tag’s JVM,
the plugin will not need to start a new JVM. OF course, the applet tag’s JVM spec may exceed the JNLP applet’s one.

<applet code="org.jdesktop.applet.util.JNLPAppletLauncher"
   <param name="codebase_lookup" value="false">
   <param name="subapplet.classname" value="demos.applets.GearsApplet">
   <param name="subapplet.displayname" value="JOGL Gears Applet">
   <param name="noddraw.check" value="true">
   <param name="progressbar" value="true">
   <param name="jnlpNumExtensions" value="1">
   <param name="jnlpExtension1"
   <param name="java_arguments" value="-Dsun.java2d.noddraw=true">
   <param name="jnlp_href" value="applet-gears.jnlp">

Where the referenced JNLP file applet-gears.jnlp looks as follow:

<?xml version="1.0" encoding="utf-8"?>
<jnlp href="applet-gears.jnlp">
    <title>JOGL JNLP Applet Gears Demo</title>
    <vendor>Sun Microsystems, Inc.</vendor>
    <homepage href=""/>
    <description>Gears Demo</description>
    <description kind="short">Brian Paul's Gears demo ported to Java and JOGL.</description>

      <j2se href="" version="1.4+"/>
      <property name="sun.java2d.noddraw" value="true"/>
      <jar href="" main="true"/>
      <jar href=""/>
      <extension name="jogl-all-awt" href="" />


The above demo is online here

In the next part I will explain the partitioning of the new JOGL, JAR and JNLP files.

Note: A bug on MacOSX is known, launching 2 JOGL applets in 2 tabs.

9 thoughts on “JOGL: Applets (part 1)”

  1. thank you for the update. First startup experience is not as good as it could be since webstart scales not very well with increasing jar count. It is a sequential (and not parallel) download -> verify jar -> download process which slows everything down (already filed an bug at least one year ago but i can’t find it in the db). Jogl1 had 2 jars, Jogl2 has a lot more 😉

    Preventing two jvms from boot would be cool too (sometimes it worked for me when i duplicated all jvm args in the applet tag), but i fear this is an feature rather than a bug…
    (tested on ubuntu 32, ping me if you need more info)

  2. Ok .. changed the applet tags, so only one JVM is started, added a note as well.
    Also changed the jnlp files ‘jogl-all-awt.jnlp’ and ‘nativewindow-awt.jnlp’
    to use the *.all.jar archives and not to load more jogl/nativewindow extensions.

  3. I don’t care much about the download case (empty cache), since it takes tame anyways.
    The restart case is important IMHO and that’s where it is faster as well,
    as you said check-date, verify, ..

  4. Nice that you are considering the OSX cases 🙂 The applet/tab bug you mentioned is a bit worse under firefox since the applet in 1 tab draws over the screen real estate in all tabs and even the address/bookmarks toolbar.

    Anyway, with that aside. This dual approach looks quite interesting. Will this support easy switching into full screen mode even from the applet fallback?

  5. @Peter: I know .. 1 tab 4 all 🙂
    Fullscreen applets ? Well, I don’t want to speak for AWT here :),
    but I will show a NEWT-AWT applet demo, and later, after finishing the AWT-Less plugin feature,
    we don’t even need to use AWT anymore.

  6. Sounds Very interesting! The NEWT only plugin sounds really interesting, especially if it’s running on mac 🙂

  7. Me again, Just interested in progress on “JOGL: Applets (part 2)”

    Actually I’m just looking for a complete example using the above deployement descriptors, applet source code, what jars need to be where, what jvm flags are required, maybe newt based? Also I’m pretty useless around applets, but assuming I make use of the PersistenceService from jnlp, will my app run jogl without a certificate ‘requesting unrestricted access’. I have it signed currently because I cach some objects locally and also write a client side logfile and prefferences. Sounds like the above combination combined with applet/jnlp combination should eliminate that? or are there other sandbox restrictions that might trip a jogl app up?

    PS Great to see you are so active on JOGL these days! great job!

Comments are closed.