Target Audience
Java/JSP developers on Tomcat and Application Server administrators.

Problem
Tomcat 5.5 (unlike Tomcat 5.0 and versions below) comes with Eclipse JDT compiler enabled by default for JSP compilation. JDT compiler is not jdk 1.5 compliant as of now.

Solution
To just use the javac 1.5 compiler with Java 1.4 source code compliant JSP pages (you cannot use generics or autoboxing in scripted jsp code and other Java 1.5 features) and Java 1.4 compliant target classes generated, you have to add tools.jar from your %JAVA_HOME%\lib directory to %TOMCAT_HOME%\common\lib.
Then replace the jasper-compiler-jdt.jar with ant.jar in %TOMCAT_HOME%\common\lib. Make sure you have downloaded the latest version of Ant.

To enable 1.5 features in your JSP files (like generics and autoboxing for example) you need to additionally modify %TOMCAT_HOME%\conf\web.xml file.

You need to add two init parameters as shown below in bold:

    < servlet>
        < servlet-name>jsp< /servlet>
        < servlet-class>org.apache.jasper.servlet.JspServlet< /servlet>
        < init-param>
            < param-name>fork< /param-name>
            < param-value>false< /param-value>
        < /init-param>
        < init-param>
            < param-name>compilerSourceVM< /param-name>
            < param-value>1.5< /param-value>
        < /init-param>
        < init-param>
            < param-name>compilerTargetVM< /param-name>
            < param-value>1.5< /param-value>
        < /init-param>
        < init-param>
            < param-name>xpoweredBy< /param-name>
            < param-value>false< /param-value>
        < /init-param>
        < load-on-startup>3< /load-on-startup>
    < /servlet>

The compilerSourceVM and compilerTargetVM parameters indicates the compiler to assume the source is Java 1.5 compliant and the target classes generated will be Java 1.5 compliant.

Side Effect
This also enables Ant. Javac is invoked from Ant.

Please do not ask me further questions on the topic. Please read the Tomcat source code for further explanation, if required.

The procedure has been well tested and works without exception. The instructions are tailored for Windows platforms. Please adapt the instructions (minor changes) suitably for Unix/Linux platforms.

Comments are welcome.