As you can see from my testing and comment in bug 54461 (https://issues.apache.org/bugzilla/show_bug.cgi?id=54461), after much effort I discovered that "complier" is indeed a parameter, but so is "compilerClassName." In order to use anything other than the Eclipse JDT compiler, "compilerClassName" must be set to the class name of an alternative org.apache.jasper.compiler.Compiler implementation. The only other implementation at the moment is org.apache.jasper.compiler.AntCompiler. The "compiler" parameter ONLY affects the AntCompiler compiler right now, and is ignored if the JDTCompiler is in use. (No matter what I set "compiler" to, I get "org.apache.jasper.compiler.JDTCompiler generateClass WARNING: Unknown source VM 1.8 ignored" warnings UNLESS I also set compilerClassName to AntCompiler.)
That aside, my original problem is still unanswered. It appears AntCompiler, like JDTCompiler, still uses some compiler other than the JDK's built-in javac compiler. Whether I specify "classic," "modern," or "extJavac" as the "compiler" for AntCompiler, I get syntax errors for the lambda expression in my JSP. The same lambda expression compiles fine in my JDK compiler. So, is there any way to use the JDK compiler to compile JSPs? Or, am I stuck compiling JSPs at Java 7 until either Eclipse or Ant starts supporting Java 8? Thanks, Nick -----Original Message----- From: Williams, Nick [mailto:nicholas.willi...@ul.com] Sent: Monday, January 21, 2013 9:42 PM To: Tomcat Developers List (dev@tomcat.apache.org) Subject: Compiling JSPs with JDK 1.8 in Tomcat 8 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. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org