javac 目标版本 1.3 与默认的源版本 1.5 冲突

开发JSP,使用Eclipse(JDK1.5),部署WEB应用Tomcat5.0.29
请求JSP时,Tomcat日志显示“javac: 目标版本 1.3 与默认的源版本 1.5 冲突”
查看上面的错误日志,发现"compilerTargetVM=1.3",应该时Tomcat的JSP编译时使用的JDK1.3的版本。
进行如下修改:

找到tomcat conf目录下的web.xml,将这段内容:

Java代码 复制代码
  1. <servlet>   
  2.     <servlet-name>jsp</servlet-name>   
  3.     <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>   
  4.     <init-param>   
  5.         <param-name>fork</param-name>   
  6.         <param-value>false</param-value>   
  7.     </init-param>   
  8.     <init-param>   
  9.         <param-name>xpoweredBy</param-name>   
  10.         <param-value>false</param-value>   
  11.     </init-param>   
  12.     <load-on-startup>3</load-on-startup>   
  13. </servlet>  
    <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>
    </servlet>



改为如下

Java代码 复制代码
  1. <servlet>   
  2.       <servlet-name>jsp</servlet-name>   
  3.       <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>   
  4.       <init-param>   
  5.       <param-name>compilerSourceVM</param-name>   
  6.       <param-value>1.5</param-value>   
  7.       </init-param>   
  8.       <init-param>   
  9.       <param-name>compilerTargetVM</param-name>   
  10.       <param-value>1.5</param-value>   
  11.       </init-param>   
  12.       <init-param>   
  13.           <param-name>fork</param-name>   
  14.           <param-value>false</param-value>   
  15.       </init-param>   
  16.       <init-param>   
  17.         <param-name>compiler</param-name>   
  18.         <param-value>modern</param-value>   
  19.       </init-param>   
  20.       <init-param>   
  21.           <param-name>xpoweredBy</param-name>   
  22.           <param-value>false</param-value>   
  23.       </init-param>   
  24.       <load-on-startup>3</load-on-startup>   
  25.   </servlet> 

你可能感兴趣的:(apache,eclipse,tomcat,jsp,servlet)