新手问题 郁闷哦~~~~~~~~~第一个JSP程序都运行不了哦

pythonjyc 2004-09-12 10:18:37
JDK 安装正常 TOMCAT 安装也正常 (自带的JSP例子也可以运行)

从书上拷贝一个很小的JSP程序(共5行)

运行就出错 不知道那里出了问题 请大家帮忙解答 先谢过了~~~~~~~~~~
...全文
198 23 打赏 收藏 转发到动态 举报
写回复
用AI写文章
23 条回复
切换为时间正序
请发表友善的回复…
发表回复
pythonjyc 2004-09-14
  • 打赏
  • 举报
回复
to zwp315(城市大嫖客)
确认JSDK安装没问题
按下面设置

JAVA_HOME=c:\j2sdk1.4.2
classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;
path=%JAVA_HOME%\bin

在命令行输入:javac
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-O Optimize; may hinder debugging or enlarge class file

-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are u
ed
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options

如果出现一大堆什么参数之类 说明变量设置好了
pythonjyc 2004-09-13
  • 打赏
  • 举报
回复
个人感触:小问题可以学到很多东西

体会:不要想当然 只要是问题就是大问题
pythonjyc 2004-09-13
  • 打赏
  • 举报
回复
问题终于解决

不是其他的问题 就一个问题 路径问题

myJSPs是webapps下的子文件夹 我在窗口运行程序的路径:

http://localhost:8080/webapps/myJSPs/Hello.jsp 结果找不到路径 运行错误

换成:http://localhost:8080/myJSPs/Hello.jsp 运行成功

问题解决 不过还是有疑问 为什么上面哪个会出错误
zhonghua2003 2004-09-13
  • 打赏
  • 举报
回复
放在webapps\ROOT下
zwp315 2004-09-13
  • 打赏
  • 举报
回复
搂住帮忙看看:
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


是啥原因阿?set JAVA_HOME=C:\j2sdk1.4.1 按说没得问题啊
AHUA1001 2004-09-12
  • 打赏
  • 举报
回复
书上的代码就象你这样吗?不完整吧,还需要引一个包吧。
mzgdqqq 2004-09-12
  • 打赏
  • 举报
回复
目录问题。你好好看下吧
skyboy0720 2004-09-12
  • 打赏
  • 举报
回复
是说这个:webapps/myJSPs/Hours/myjsp.jsp
默认就应该是webapps/root/myjsp.jsp
pythonjyc 2004-09-12
  • 打赏
  • 举报
回复
TO skyboy0720(神仙?妖怪?谢谢!)

默认目录指安装目录么? 这个有影响么?
skyboy0720 2004-09-12
  • 打赏
  • 举报
回复
建议初学就用默认目录!!
skyboy0720 2004-09-12
  • 打赏
  • 举报
回复
<%@ page language="java" contentType="text/html;charset=gb2312" %>
<HTML>
<HEAD><TITLE>A Simple JSP</TITLE></HEAD>
<BODY>
<FONT COLOR="blue" FACE="Trebuchat">
Hello! The time is now <%= new java.util.Date() %>
</CENTER>
</FONT>
</BODY>
</HTML>
pythonjyc 2004-09-12
  • 打赏
  • 举报
回复
1. 启动tomcat(里面的例子都可以运行)

2。不会配置tomcat/conf/server.xml 请帮忙

3。 文件在那里

4。8080

问题出在第二个 请帮忙配置一下 先谢过了~~~~~~~~~~~~~
qukmei 2004-09-12
  • 打赏
  • 举报
回复
描述不清楚,下次清楚一些

1、启动tomcat了吗?

2、你用的是tomcat什么版本?配过tomcat/conf/server.xml吗?

3、文件真的在那里吗?

4、你的端口是什么?
pythonjyc 2004-09-12
  • 打赏
  • 举报
回复
不知道是那里配置 出问题了

请大家帮忙哦
pythonjyc 2004-09-12
  • 打赏
  • 举报
回复
HTTP Status 404 - /webapps/myJSPs/Hours/myjsp.jsp

type Status report

message /webapps/myJSPs/Hours/myjsp.jsp

description The requested resource (/webapps/myJSPs/Hours/myjsp.jsp) is not available.

Apache Tomcat/4.1.30


程序:<HTML>
<HEAD><TITLE>A Simple JSP</TITLE></HEAD>
<BODY>
<FONT COLOR="blue" FACE="Trebuchat">
Hello! The time is now <%= new java.util.Date() %>
</CENTER>
</FONT>
</BODY>
</HTML>
netbian 2004-09-12
  • 打赏
  • 举报
回复
源代码和错误信息贴出来啊
Jason_guo 2004-09-12
  • 打赏
  • 举报
回复
冷静思考为什么不行。我也常常调试一些自己没有做过的东西。关键不是技术,是想法
---------------------------------------
我设计的服务器已经支持CGI了:
http://osdev.dec.cn:8080/gb1/index.pl
Jason_guo 2004-09-12
  • 打赏
  • 举报
回复
错误呢?
程序呢?
---------------------------------------
我设计的服务器已经支持CGI了:
http://osdev.dec.cn:8080/gb1/index.pl
pythonjyc 2004-09-12
  • 打赏
  • 举报
回复
to power17()

TOMCAT运行正常 里面的例子都可以运行

程序也是从书上找的 (很简单的)

路径设置也没有错 可还是路径找不到的问题

郁闷到极点了~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





huyuleizj 2004-09-12
  • 打赏
  • 举报
回复
<%@ page ... %>一定要有
另外,如果嫌在webapps\ROOT下运行不方便,可以在server.xml文件中修改。例如:添加
<Context path="/jsp" docBase="f:/jsp" debug="0" reloadable="true" >
</Context>
加载更多回复(3)

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧