Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #28591

Re: JDK 1.8 Power not Available for the Web, Yes or No?

From MilkoB <mbrbc111@cogeco.ca>
Newsgroups comp.lang.java.programmer
Subject Re: JDK 1.8 Power not Available for the Web, Yes or No?
References <lm5lkl$j95$1@news.albasani.net> <53866001$0$303$14726298@news.sunsite.dk>
Message-ID <hhuhv.1115596$y81.951875@fx13.iad> (permalink)
Date 2014-05-28 19:27 -0400

Show all headers | View raw


On 05/28/2014 06:15 PM, Arne Vajhøj wrote:
> On 5/28/2014 5:49 PM, Jan Burse wrote:
>> I made a small experiment recently with JSP
>> and got the impression that the full power
>> of the JDK 1.8 is currently not available for
>> the web.
>
>> So it seems that all this fuzz about closures
>> doesn't carry over to the web. Which makes me
>> currious about some of the web frameworks from
>> some of the functional languages camps.
>>
>> But I might also be totally wrong, i.e. that
>> I don't have the right tomcat version etc..
>> and that the web can profit from JDK 1.8. But
>> I didn't find much through googling so far.
>
> A given version of Tomcat uses a given version of a
> Java compiler.
>
> If your version of Tomcat does not use a Java compiler
> that supports Java 1.8 then it is obviously a no go.
>
> I am sure that eventually Tomcat will ship with a 1.8
> compiler.
>
> If you can't wait then use Google to find the description
> of how to change the version of ECJ that Tomcat uses (all
> recent Tomcat versions uses the Eclipse compiler not the
> regular SUN/Oracle JDK compiler). An 1.8 compatible ECJ do
> exist.
>
> Arne


The original poster needs to install Tomcat 8 and configure it to use 
JDK 1.8/J2EE 7.

Then, open the Tomcat 8's $CATALINA_HOME/conf/web.xml in an editor, find 
the following section at around line 230 in the web.xml, add the lines 
between the two comments below

        <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>
  <!-- Add the following new lines exactly here -->
          <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>compiler</param-name>
              <param-value>modern</param-value>
           </init-param>
  <!-- End of newly added lines                -->
        </servlet>

and restart Tomcat. That should make Tomcat 8 start using javac
from the Oracle/Sun JDK 8 instead of built-in ECJ.

Hope this helps,

MB

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

JDK 1.8 Power not Available for the Web, Yes or No? Jan Burse <janburse@fastmail.fm> - 2014-05-28 23:49 +0200
  Re: JDK 1.8 Power not Available for the Web, Yes or No? Arne Vajhøj <arne@vajhoej.dk> - 2014-05-28 18:15 -0400
    Re: JDK 1.8 Power not Available for the Web, Yes or No? MilkoB <mbrbc111@cogeco.ca> - 2014-05-28 19:27 -0400
  Re: JDK 1.8 Power not Available for the Web, Yes or No? Joerg Meier <joergmmeier@arcor.de> - 2014-05-29 01:03 +0200
    Re: JDK 1.8 Power not Available for the Web, Yes or No? Jan Burse <janburse@fastmail.fm> - 2014-05-29 11:58 +0200
  Re: JDK 1.8 Power not Available for the Web, Yes or No? Jan Burse <janburse@fastmail.fm> - 2014-05-29 10:50 +0200
    Re: JDK 1.8 Power not Available for the Web, Yes or No? Jan Burse <janburse@fastmail.fm> - 2014-05-29 10:59 +0200

csiph-web