主题:请指点我都已经成功安装了J2SDK和Tomact,测试页面怎么出不来!
我都已经成功安装了J2SDK和Tomact,并且在DOS下测试的JAVA程序也没问题,安装完TOMCAT后的TOMACT的欢迎页面也出来了,可按照5~7步的操作所生成的JSP测试页面怎么出不来!请指教
[color=00FFFF]
[安装步骤] [/color]
1.安装完j2sdk以后,在我的电脑->属性->高级->环境变量->系统变量中添加以下环境变量(假定你的j2sdk安装在c:\j2sdk1.4.2):
JAVA_HOME=c:\j2sdk1.4.2;
classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;(.;不能少,表示当前路径)
path= %JAVA_HOME%\bin; (系统里已经有了path变量,只需要在path最前面加上去即可)
然后可以写一个简单的java程序来测试J2SDK是否已安装成功:
public class Myjava{
public static void main(String args[]){
System.out.println("试试看,装好了吗?."); ([color=FF0000]我已经成功看到,说明没问题吧!)[/color]
}
}
2.安装Tomcat后,在我的电脑->属性->高级->环境变量->系统变量中添加以下环境变量(假定你的tomcat安装在c:\tomcat5):
CATALINA_HOME=c:\tomcat5;
CATALINA_BASE=c:\tomcat5;
然后修改环境变量中的classpath,把tomat安装目录下的common\lib下的servlet-api.jar(此文件在tomcat5以前名为:servlet.jar)追加到classpath中去,修改后的classpath如下:
classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\common\lib\servlet-api.jar; (最好再拷贝到:C:\j2sdk1.4.2\jre\lib\ext目录下)
接着可以启动tomcat,在IE中访问http://localhost:8080,如果看到tomcat的欢迎页面的话说明安装成功了.[color=FF00FF](我已经成功看到,说明没问题吧)[/color]
第三步:建立自己的jsp app目录
1.到Tomcat的安装目录的webapps目录,可以看到ROOT,examples等Tomcat自带的的目录;
2.在webapps目录下新建一个目录,起名叫myapp;
3.myapp下新建一个目录WEB-INF,注意,目录名称是区分大小写的;
4.WEB-INF下新建一个文件web.xml,内容如下:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>My Web Application</display-name>
<description>
A application for test.
</description>
</web-app>
5.在myapp下新建一个测试的jsp页面,文件名为index.jsp,文件内容如下:
<html>
<head><title>大家好</title>
</head>
<body>
<% out.println(" 大家好,我的第一个jsp程序"); %>
</body>
</html>
6.重启Tomcat
7.打开浏览器,输入http://localhost:8080/myapp/index.jsp 即可.([color=FF0000]这个测试的页面没出来,请问是怎么回事?) [/color]
IE提示的错误是这样的:
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.
[color=00FFFF]
[安装步骤] [/color]
1.安装完j2sdk以后,在我的电脑->属性->高级->环境变量->系统变量中添加以下环境变量(假定你的j2sdk安装在c:\j2sdk1.4.2):
JAVA_HOME=c:\j2sdk1.4.2;
classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;(.;不能少,表示当前路径)
path= %JAVA_HOME%\bin; (系统里已经有了path变量,只需要在path最前面加上去即可)
然后可以写一个简单的java程序来测试J2SDK是否已安装成功:
public class Myjava{
public static void main(String args[]){
System.out.println("试试看,装好了吗?."); ([color=FF0000]我已经成功看到,说明没问题吧!)[/color]
}
}
2.安装Tomcat后,在我的电脑->属性->高级->环境变量->系统变量中添加以下环境变量(假定你的tomcat安装在c:\tomcat5):
CATALINA_HOME=c:\tomcat5;
CATALINA_BASE=c:\tomcat5;
然后修改环境变量中的classpath,把tomat安装目录下的common\lib下的servlet-api.jar(此文件在tomcat5以前名为:servlet.jar)追加到classpath中去,修改后的classpath如下:
classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;%CATALINA_HOME%\common\lib\servlet-api.jar; (最好再拷贝到:C:\j2sdk1.4.2\jre\lib\ext目录下)
接着可以启动tomcat,在IE中访问http://localhost:8080,如果看到tomcat的欢迎页面的话说明安装成功了.[color=FF00FF](我已经成功看到,说明没问题吧)[/color]
第三步:建立自己的jsp app目录
1.到Tomcat的安装目录的webapps目录,可以看到ROOT,examples等Tomcat自带的的目录;
2.在webapps目录下新建一个目录,起名叫myapp;
3.myapp下新建一个目录WEB-INF,注意,目录名称是区分大小写的;
4.WEB-INF下新建一个文件web.xml,内容如下:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>My Web Application</display-name>
<description>
A application for test.
</description>
</web-app>
5.在myapp下新建一个测试的jsp页面,文件名为index.jsp,文件内容如下:
<html>
<head><title>大家好</title>
</head>
<body>
<% out.println(" 大家好,我的第一个jsp程序"); %>
</body>
</html>
6.重启Tomcat
7.打开浏览器,输入http://localhost:8080/myapp/index.jsp 即可.([color=FF0000]这个测试的页面没出来,请问是怎么回事?) [/color]
IE提示的错误是这样的:
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.