File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Tomcat JSPs and JRE 5.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat JSPs and JRE 5.0" Watch "Tomcat JSPs and JRE 5.0" New topic

Tomcat JSPs and JRE 5.0

Todd Johnson
Ranch Hand

Joined: Sep 03, 2005
Posts: 61
Sorry if this is a stupid question, but I just started learning java about a month ago.

My development environment is J2SE 5.0 and Tomcat 5.5.9. When I'm writing servlets, or any other classes that I directly compile myself I can use the new J2SE 5.0 features (the collection based for loop, generic classes, etc). In fact in the case of collections I get warnings if I don't use the generics.

However when I write a JSP, if I try to use the 5.0 features such as the collection based for loop or the generics class types, tomcat won't compile the JSP. Am I doing something wrong, or do I am I forced to use 1.4 features only in JSPs?

Thanks in advance!
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

Since this is Tomcat-specific, I've moved it to the Tomcat forum.

[Asking smart questions] [About Bear] [Books by Bear]
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

From Apache Tomcat documentation -

The Java compiler from Eclipse JDT in included as the default compiler. It is an advanced Java compiler which will load all dependencies from the Tomcat class loader, which will help tremendously when compiling on large installations with tens of JARs. On fast servers, this will allow sub-second recompilation cycles for even large JSP pages. This new compiler will be updated to support the Java 5 syntax as soon as possible.

It should be possible to configure Tomcat to use the Sun JDK compiler. Or you can switch to an earlier stable Tomcat version (I think 5.0.28).


The future is here. It's just not evenly distributed yet. - William Gibson
Sonny Gill LinkedIn
Dave Salter
Ranch Hand

Joined: Jul 20, 2005
Posts: 293

Yes, Tomcat doesn't use the JDK that you have installed, it uses its "internal" compiler.

There's an articlehere that explains how you can configure Tomcat to use the JDK to compile JSPs so you can then use 1.5 features in them.


subject: Tomcat JSPs and JRE 5.0
It's not a secret anymore!