17
21

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

tomcatのjspでjava8を使えるようにする。

Posted at

javaをjava8にあげて、jsp内でlambdaを使おうとしたら怒られた。ググってみたら、jspで使用するコンパイラの設定が必要
とのことでした。

参考というかそのままですが。
http://docs.escenic.com/ece-tech-notes/5.7/jsp_servlet_configuration.html

考えてみれば当たり前ですが、忘れがちなのでメモ。

TOMCAT_HOME/conf/web.xml のjsp servletにcompilerSourceVMとcompilerTargetVM設定を追加。

TOMCAT_HOME/conf/web.xml
   <servlet>
        <servlet-name>jsp</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <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>
        <load-on-startup>3</load-on-startup>
        <!-- ここから下の2項目を追加 -->
        <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>
    </servlet>
17
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
21

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?