This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Java bug: Object tag and archive attribute

 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that I have found a bug in Java itself, not a browser bug, regarding the Object tag, the 'archive' attribute of the Object tag, and the archive attribute's interaction with Java's internal AppletClassLoader.


I think a little background detail is needed here. Java applets were first embeded into web pages with the APPLET tag and the "archive" attribute on the APPLET tag was a comma-separated list -- this part is important! The replacement for APPLET is supposed to be the Object tag which also has an "archive" attribute but this version of the "archive" attribute takes a space-separated list of values.


So, to the bug, I open the Java Console, trigger logging mode, set trace to level 5, and then open a page with an applet, embeded with the Object tag, using the attribute: (the full version is found below).

This is what appears in the Java Console using Object's version of the archive attribute:
Plugin2ClassLoader.addURL parent called for file:/C:/Desktop/applet/applet/myApplet.class archive1.jar archive2.jar

-- Java thinks it has a single file name: "myApplet.class archive1.jar archive2.jar"

-- Java should have seen three files and cached at least two (the jar files):
1 myApplet.class
2 archive1.jar
3 archive2.jar


Okay, so then, after that, I added a Param tag, formatted using a comma-separated list, just like the APPLET tag uses:

Java's new output:

Plugin2ClassLoader.addURL parent called for file:/C:/Desktop/applet/applet/archive1.jar
Plugin2ClassLoader.addURL parent called for file:/C:/Desktop/applet/applet/archive2.jar


Now it works. Java's applet class loader found the jar files and called them.

So, it appears, that Java's internal class loader is broken -- it only takes a comma-separated list for reading an archive attribute's value. This conflicts with Object's specification of the archive tag which is space-separated. Yet what happens is that Java can't read Object's archive attribute correctly if its longer than 1 item long because Java only reads comma-separated lists of archives.

Run using Java Plug-in 1.6.0_32, that's Java SE 1.6.0_32 release (the current latest version from http://www.java.com).

Just so you know, if you try to recreate this, this is how I sorted my File Locations:
C:\Desktop\applet -- where the html file using the Object tag is located.
C:\Desktop\applet\applet -- where the applet's *.class and .jar files are located.

The full object code (and this was intentionally made verbose for maximum use and browser support) (Note: the code is html 4.01 not xhtml, so remember to close the param tags with slash-bracket "/>" if you copy this code into an xhtml file):

 
Ranch Hand
Posts: 77
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Walter Gabrielsen Iii wrote:..The replacement for APPLET is supposed to be the Object tag ..



Oracle currently supports the Deployment Toolkit Script.
 
Saloon Keeper
Posts: 6511
158
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, don't use OBJECT or EMBED. The APPLET tag works fine in my experience, though, but it doesn't handle checking for a particular Java version being installed, and steering the user to download it if necessary.
 
Walter Gabrielsen Iii
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes using the Applet tag, or the script, does work. So does overloading Object with param values.

I just find it odd that Java can choke up over the difference between a space and a comma. It must be Java's rendering engine that chokes because I'm following its messages through the Java Console in multiple browsers.
 
Screaming fools! It's nothing more than a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic