Reputation: 5010
Is tomcat 8 (today as RC1 - see this) supporting Java 8, even if it is still in beta?
Among others Tomcat 8 supports Java EE 7:
I had trouble in the past with Tomcat 7 / Java 7, that's why I am asking this question.
Update
An interesting article on infoq indicates that tomcat 8 is ready for java 8. Even Tomcat 7 would be.
See the article here
If you see any compatibility issue, I will report it here.
Upvotes: 31
Views: 58563
Reputation: 47
Thanks Chewy, I was searching for last 1 hour to compile lambdas within jsp it worked for me.
Updated the jsp section in tomcat's web.xml as follows (only this much change was required):
<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>compiler</param-name>
<param-value>modern</param-value>
</init-param>
<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.8</param-value>
</init-param>
<init-param>
<param-name>compilerTargetVM</param-name>
<param-value>1.8</param-value>
</init-param>
<init-param>
<param-name>suppressSmap</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>mappedfile</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
Upvotes: 2
Reputation: 603
you can initialize compile value inside web..xml then you can able to Used Tomcat8.
Tomcat 8: Servlet 3.1, JSP 2.3, and EL 3.0.
Upvotes: 0
Reputation: 651
It does not support out of the box. You must make some changes. in apache home\conf\web.xml add the following lines in the jsp section.
<init-param>
<param-name>compiler</param-name>
<param-value>modern</param-value>
</init-param>
<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.8</param-value>
</init-param>
<init-param>
<param-name>compilerTargetVM</param-name>
<param-value>1.8</param-value>
</init-param>
<init-param>
<param-name>suppressSmap</param-name>
<param-value>true</param-value>
</init-param>
I also added to my classpath in setenv.sh (or bat) the follwing entry:
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$CLASSPATH
Note that I also need to have java_home set to 1.8 (little bit of a duh here, but may be worth mentioning)
Here are some sources: http://tomcat.apache.org/tomcat-8.0-doc/jasper-howto.html http://mail-archives.apache.org/mod_mbox/tomcat-dev/201301.mbox/%3C7CF0788AAB53854AB15567D68F41960238297F32@CH1PRD0410MB369.namprd04.prod.outlook.com%3E
Upvotes: 5
Reputation: 2260
I have tried on Linux and it does not work. When it comes to executing a lambda expression in JSP page the following error is thrown
Lambda expressions are allowed only at source level 1.8 or above Apache Tomcat/8.0.14
it runs on JDK jdk1.8.0_25
Upvotes: 2
Reputation: 699
Tested Tomcat 7.0.50 with Web app written on Java 8 + Spring 4.0.2, using lambda expressions, method references and streams - works like a charm!
Upvotes: 10
Reputation: 2100
Tomcat 8.0 is designed to run on Java 7. For reference, the following specifications have been supported:
See more at: http://blog.gopivotal.com/products/apache-tomcat-8-what-it-is-what-you-need-to-know#sthash.nVw8CTJ9.dpuf
Upvotes: 3
Reputation: 10110
According to the Tomcat Docs:
Any installed Java 7 or later JRE (32-bit or 64-bit) may be used.
Upvotes: 33