Java Applets: Web 2.0’s retarted step-child

They are still supported but Sun’s documentation has gone to pot. There’s almost nothing out there describing implementing applets with Java SE 6. Sure there are a lot of examples with 1.4, but the world has changed modern browsers and W3C have deprecated the applet tag, and if you’re trying to do something like interact with your applet via javascript there’s almost nothing discussing this and of course the old Applet tag is broken in “Modern” browsers, and although there are 20 examples they all seem to be toys with respect to Web 2.0, namely they are still using the applet tag, thanks for coming out.

Here’s what I’ve come up with for embedding applets and interacting with them via javascript, it’s a bit hackish but it has the cleanest/simplest code I could come up with.

    <!–[if !IE]> Firefox and others will use outer object –>
    <embed type=”application/x-java-applet”
           style=”position:absolute; top:-1000px; left:-1000px;”>
            <object classid=”clsid:CAFEEFAC-0016-0000-FFFF-ABCDEFFEDCBA”
style=”position:absolute; top:-1000px; left:-1000px;”
                <param name=”code” value=”com.yourco.MacAddressApplet”>
                <param name=”archive” value=”macaddress.jar” >
                <param name=”mayscript” value=”true”>
                <param name=”scriptable” value=”true”>
                <param name=”width” value=”0″>
                <param name=”height” value=”0″>
        <!–[if !IE]> Firefox and others will use outer object –>

Once I’ve repackaged the applet which “sniffs” the first MAC Address of any interface on your machine, which I guess could come in handy from time to time.

Leave a Reply