熟悉myecplise 6.5的大侠进来看一下
程序如下:
<%@ page contentType="text/html;charset=GB2312" %>
<HTML><BODY bgcolor=cyan ><FONT size=4>
<%! final double PI=Math.PI;
double r;
double getArea(double a){
return PI*a*a;
}
double getLength(double a) {
return 2*PI*a;
}
%>
<% r=100;
out.println("调用getArea方法计算半径是"+r+"的园的面积:");
double area=getArea(r);
out.println(area);
r=50;
out.println("<BR>调用getLength方法计算半径是"+r+"的园的周长:");
double length=getLength(r);
out.println(length);
%>
</FONT></BODY></HTML>
我TOMCAT 5.0已经可以成功启动;而且我的jdk在D盘,jre home directory如下D:/java;
结果是如下:
2011-6-2 20:55:02 org.apache.jasper.compiler.Compiler generateClass
严重: Error compiling file: /E:/Tomcat 5.0/work/Catalina/localhost/ch3//org/apache/jsp\example_jsp.java [javac] Compiling 1 source file
输入http://localhost:8080/ch3/index.jsp如下:
HTTP Status 500-
--------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:346)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:414)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:106)
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:935)
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
--------------------------------------------
[解决办法]
Perhaps JAVA_HOME does not point to the JDK
这个有问题么?
[解决办法]
这个和myeclipse有关系吗?Unable to find a javac compiler;这是问题关键,JAVA_HOME does not point to the JDK 没找到javac
[解决办法]
环境的问题,重装jdk
myeclipse6.5t太老了,直接用9.0
[解决办法]
jsp没错,是环境问题!建议重装jdk
[解决办法]