Ant 1.6.2 doesn’t work on Java 1.4.1

Little warning for anyone else who stumbles across this problem: the stylesheet used for <junitreport> in Ant 1.6.2 does not work with Xalan 2.2. Unfortunately, this is the version that’s bundled inside the rt.jar in Java 1.4.1.

The symptom is that it complains about a ClassNotFoundException for ‘redirect’. The solution is to upgrade to using Xalan 2.6. Unfortunately, that’s not as easy as it could be.

Fortunately, the Xalan guys have come across this before and very nicely have given instructions on how to overcome it.

This is not a problem for Java 1.4.2, BTW.

—-

Updated: The Ant Bugzilla ID for this is 30200

—-

Updated again: This is what the error looks like:

[junitreport] jar:file:/D:/work/3rdparty/apache/ant/lib/ant-junit.jar!
/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl;
Line 41; Column 53; javax.xml.transform.TransformerException:
java.lang.ClassNotFoundException: redirect
[junitreport] jar:file:/D:/work/3rdparty/apache/ant/lib/ant-junit.jar!
/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl;
Line 46; Column 57; javax.xml.transform.TransformerException:
java.lang.ClassNotFoundException: redirect
[junitreport] jar:file:/D:/work/3rdparty/apache/ant/lib/ant-junit.jar!
/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl;
Line 51; Column 64; javax.xml.transform.TransformerException:
java.lang.ClassNotFoundException: redirect
[junitreport] jar:file:/D:/work/3rdparty/apache/ant/lib/ant-junit.jar!
/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl;
Line 56; Column 62; javax.xml.transform.TransformerException:
java.lang.ClassNotFoundException: redirect
[junitreport] jar:file:/D:/work/3rdparty/apache/ant/lib/ant-junit.jar!
/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl;
Line 61; Column 64; javax.xml.transform.TransformerException:
java.lang.ClassNotFoundException: redirect

And so on and so forth….

Author: Robert Watkins

My name is Robert Watkins. I am a software developer and have been for over 20 years now. I currently work for people, but my opinions here are in no way endorsed by them (which is cool; their opinions aren’t endorsed by me either). My main professional interests are in Java development, using Agile methods, with a historical focus on building web based applications. I’m also a Mac-fan and love my iPhone, which I’m currently learning how to code for. I live and work in Brisbane, Australia, but I grew up in the Northern Territory, and still find Brisbane too cold (after 22 years here). I’m married, with two children and one cat. My politics are socialist in tendency, my religious affiliation is atheist (aka “none of the above”), my attitude is condescending and my moral standing is lying down.

3 thoughts on “Ant 1.6.2 doesn’t work on Java 1.4.1”

  1. I had this problem in j2sdk1.4.1_01, Xalan 2.6.0 . Read the item at http://xml.apache.org/xalan-j/faq.html#faq-N100CC. I did not find an “endorsed” folder in the jdk installation so created an “endorsed” folder in j2sdk1.4.1_01lib and copied Xalan.jar to it. Didn’t work.

    Later found that the endorsed folder should be created in j2sdk1.4.1_01jrelib and this is what the Xalan faq refers to as . When the Xalan.jar was copied to j2sdk1.4.1_01jrelibendorsed and the ant script was run the problem went away. Hope this helps someone. However I am going to install jdk 1.4.2 or higher and do the work.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: