Barracuda - Information on using j2sdk1.4.x -vs- older JDK's
barracuda.gif (11357 bytes)There are a number of changes/additions that have been introduced in j2sdk1.4.x that may cause confusion if one is used to the behavior of older JDK's. We'll explore some of those issues below...

Issues that may cause classloader confusion using J2SE 1.4

As of J2SE 1.4, Sun started including packages such as javax.xml, org.w3c.dom and org.xml.sax in the standard runtime environment. Basically, any packages included in the j2sdk are considered "endorsed" packages. This is great, but given the needs of developers for different versions of these packages, it isn't difficult to forsee incompatibilities occurring. After a bit of research, it has been discovered that Sun had considered this issue and provided a way out of their default packages. They call this "Endorsed Standards Override Mechanism" (ESOM).

The following are instructions on how to utilize ESOM

  1. Create a directory called "endorsed" in the jre/lib/ Actually, I made double sure and did this to both the JRE in the J2SDK directory and the stand-alone JRE directory that is also installed by the J2SDK. For instance, I created the "endorsed" directory (on windows) in "C:\j2sdk1.4.1_02\jre\lib\endorsed" and "C:\Program Files\Java\j2re1.4.1_02\lib\endorsed"
  2. Copy jars that contain "endorsed" packages to the new "endorsed" directories. For starters, I'd recommend copying the latest version of Xalan there because j2sdk1.4.x includes an old, buggy version of Xalan and this will override the buggy version.

Applications such as Jakarta Tomcat may also provide a separate endorsed mechanism. Tomcat provides the CATALINA_HOME/common/endorsed directory for this purpose. It behaves exactly like the j2sdk endorsed directories but goes a step further, actually overriding jars in the JAVA endorsed directories. This is where you might want to have Xerces2 and/or Xalan (if you didn't put it in the java endorsed directories).

For more information on ESOM, visit http://java.sun.com/j2se/1.4/docs/guide/standards/index.html


Issues that may cause warnings using J2SE 1.4

There are some other issues to note when using J2SE 1.4 of which are detailed below...

Assert syntax

When compiling the Barracuda source (as of 11/29/2001) under J2SE 1.4, you will probably see a bunch of warnings like "warning: as of release 1.4, assert is a keyword, and may not be used as an identifier". This is happening when it sees syntax such as assert("Parental check 3 failed...root parent not correctly located", pchild2.getRootParent()==proot);.

This is one area where J2SE 1.4 has broken compatibility with previous JSDK's. However, two modes are supported and the default mode is backwards compatible with J2SE 1.3 to ease the transition to J2SE 1.4. Below is a quote from Sun's compatibility doc...

The assert keyword has been added to the Java Programming Language in J2SE 1.4. Because of the new keyword, existing programs that use "assert" as an identifier will not be in conformance with J2SE 1.4. The addition of this keyword does not, however, cause any problems with the use of preexisting binaries (.class files). In order to ease the transition from pre-J2SE 1.4 releases in which assert is a legal identifier to J2SE 1.4 where it isn't, the Javac bytecode compiler supports two modes of operation in J2SE 1.4.

  • In the normal mode of operation, the compiler accepts programs conforming to the specification for the previous release (J2SE 1.3). Assertions are not permitted, and the compiler generates a warning if the assert keyword is used as an identifier.

  • In an alternate mode of operation, the compiler accepts programs conforming to the specification for J2SE 1.4. Assertions are permitted, and the compiler generates an error message if the assert keyword is used as an identifier.

To enable assertions, use the following command line switch:

            -source 1.4

In the absence of this flag, the behavior defaults to "1.3" for maximal source compatibility. Support for 1.3 source compatibility is likely to be phased out over time.

Of course, the obvious question is "what syntax do we use when writing new code for Baracuda or an app that uses Barracuda"? The answer will have to come as consensus from the Barracuda community, but a good rule-of-thumb, for now, is probaby to continue using the old syntax util we make a decision to require, no less than, J2SE 1.4 for compilation and runtime with Barracuda based apps

For more information on incompatibilities introduced in J2SE 1.4, visit http://java.sun.com/j2se/1.4/compatibility.html#incompatibilities1.4

Javadoc

There is some javadoc syntax that has changed between J2SE 1.4 and previous J2SDK's. Running Javadoc on the Barracuda source without the "-breakiterator" flag produces many warnings with j2sdk1.4.x. Barracuda's build process detects j2sdk1.4.x and adds the "-breakiterator" flag to avoid these warnings.

For more information on Javadoc changes in J2SE 1.4, visit http://java.sun.com/j2se/1.4/docs/tooldocs/javadoc/whatsnew-1.4.html


General J2SE 1.4 Information

For all the latest information on Barracuda, please refer to http://barracudamvc.org
Questions, comments, feedback? Let us know...