Tomcat JSP, Eclipse JDT Compiler, Ant

JavaServerPages are compiled in Tomcat using the Eclipse JDT compiler, which came bundled with Apache Tomcat since version 5.5. The Tomcat Eclipse JDT compiler is newer than the command line javac compiler, is written in pure Java, tends to have fewer memory leaks, and thus it is better for rendering Tomcat JSP pages. Tomcat does not require the JDK’s Java compiler because Tomcat bundles and uses the Eclipse JDT compiler.
 
Users of Apache Tomcat are not restricted to the native JDT java compiler—changing some settings will allow you to compile JSP pages in Tomcat using Apache Ant. While Apache Ant uses the javac compiler, you may configure Ant to use any supported Java compiler.
 
If you are encountering a Tomcat JSP error or any number of Tomcat JSP problems, you can make some changes to switch from using the default Eclipse JDT compiler to the compiler task in Apache Ant. This involves several steps beginning with moving the jasper-compiler-jdt.jar file away from the common class loader, then installing Apache Ant’s ant.jar file into the lib/ directory, and finally adding JDK’s’s tools.jar file to the lib/ directory, as described by Jason Brittain in his book Tomcat: The Definitive Guide, Second Edition (see page 55).
 
Tomcat compiling JSPs using JDT rather than Ant will then be a distant memory. When Tomcat starts, it will use Apache Ant's compiler, by default javac.
Comments on this post:
 #

I'm having problems with tomcat context memory... anyone out there?

 
 #

This is a pretty good article, but it's short. My question actually has more to do with how to use the Eclipse JDT compiler. More info. please!

 

Post new comment

The content of this field is kept private and will not be shown publicly.

Download Tcat Server - Tomcat Simplified

Develop, diagnose, manage, configure, and deploy your Apache Tomcat applications with ease, and break free from bloated legacy JEE app servers. Built on 100% Tomcat, with no changes to the core code, Tcat Server is free for developers, and there is no commitment required. Try it now, risk-free! 
 

click thumbnail to enlarge

Link to this page