I'm running an experimental environment with JDK 1.8 and Tomcat 8.0 (trunk). I understand, of course, that there are some inherent instabilities associated with doing this, but something just doesn't seem quite right.
I want JSPs to compile with Java 8, not Java 7. I understand that the Eclipse compiler obviously doesn't support that yet (and, if history is any indication, it won't until sometime in late 2014), so I wanted to configure JSPs to compile with something other than the JDT compiler. Using the documentation at http://tomcat.apache.org/tomcat-7.0-doc/jasper-howto.html, I added the following init parameters to the JSP servlet in conf\web.xml: <init-param> <param-name>compiler</param-name> <param-value>javac</param-name> </init-param> <init-param> <param-name>compilerSourceVM</param-name> <param-value>1.8</param-name> </init-param> <init-param> <param-name>compilerTargetVM</param-name> <param-value>1.8</param-name> </init-param> However, I was getting JDT warnings about unrecognized source value "1.8," meaning the JDT compiler was still being used. After lots of Googling, I discovered that the documentation was wrong about the "compiler" init parameter. The correct parameter name is "compilerClassName," not "compiler." (Subsequently, I filed https://issues.apache.org/bugzilla/show_bug.cgi?id=54461 about this documentation bug.) So I changed it to compilerClassName and then started getting errors about not being able to find a compiler (at least I knew I had the parameter name right now, because it stopped using the Eclipse compiler). I changed the value to com.sun.tools.javac.Main (another thing I found while Googling) and still got the no-compiler error. I added tools.jar to the classpath (even though JAVA_HOME was set to a JDK home, not a JRE home, which I thought would take care of that), and then I got the following error: org.apache.jasper.JasperException: java.lang.ClassCastException: com.sun.tools.javac.Main cannot be cast to org.apache.jasper.compiler.Compiler. I felt like I was now making progress, so I went to the javadocs and found the two classes that implement org.apache.jasper.compiler.Compiler: org.apache.jasper.compiler.AntCompiler and org.apache.jasper.compiler.JDTCompiler. I set the value of compilerClassName to org.apache.jasper.compiler.AntCompiler and added the Ant JARs to the classpath, and now I'm getting a new error: org.apache.jasper.JasperException: Unable to compile class for JSP Caused by java.lang.ClassNotFoundException: javac1.8 I'm at a loss here. Am I completely missing something? Or is it not possible to set Tomcat 8.0 to compile JSPs with Java 8? Thanks, Nick This e-mail may contain privileged or confidential information. If you are not the intended recipient: (1) you may not disclose, use, distribute, copy or rely upon this message or attachment(s); and (2) please notify the sender by reply e-mail, and then delete this message and its attachment(s). Underwriters Laboratories Inc. and its affiliates disclaim all liability for any errors, omissions, corruption or virus in this message or any attachments.