有关servlet类的问题

woxiechenlong 2009-12-28 07:43:01
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class Test38 extends HttpServlet
{
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException{
doPost(request,response);
}
public void doPost(HttpServletRequest request,HttpServletResponse response)
throws ServletException,IOException{
boolean b=true;
for(int i=1;i<1000;i++){
b=true;
if(i%59==1){
for(int j=2;j<i;j++){
if(i%j==0){
b=false;
break;
}
}
if(b){
System.out.println(i);
}
}
}
}
public static void main(String[]args)throws Exception{
Test38 t38=new Test38();
t38.doPost(null,null);
}
}

上述class我编译是可以通过,但是为什么运行通不过。请高手指点。
运行时错误页面如下:
...全文
64 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
crazylaa 2009-12-29
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 xuhuanchao 的回复:]
引用 5 楼 tangwei070 的回复:
引用 4 楼 woxiechenlong 的回复:
用editplus  的话 你运行时的环境就不包含serlvet.jar 了呀 除非你在环境变量里面制定了jre 并且jre下面有serlvet.jar


UP
[/Quote]
水中影子 2009-12-28
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 tangwei070 的回复:]
引用 4 楼 woxiechenlong 的回复:
用editplus  的话 你运行时的环境就不包含serlvet.jar 了呀 除非你在环境变量里面制定了jre 并且jre下面有serlvet.jar
[/Quote]

UP
zl3450341 2009-12-28
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 woxiechenlong 的回复:]
错误代码如下:
Exception in thead"main"java.lang.NoClassDefFoundError:javax/servlet/http/HttpServlet
我用的是EditPlus软件编译和运行的。
[/Quote]

jar包没导入
tangwei070 2009-12-28
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 woxiechenlong 的回复:]
错误代码如下:
Exception in thead"main"java.lang.NoClassDefFoundError:javax/servlet/http/HttpServlet
我用的是EditPlus软件编译和运行的。
[/Quote]
用editplus 的话 你运行时的环境就不包含serlvet.jar 了呀 除非你在环境变量里面制定了jre 并且jre下面有serlvet.jar
woxiechenlong 2009-12-28
  • 打赏
  • 举报
回复
错误代码如下:
Exception in thead"main"java.lang.NoClassDefFoundError:javax/servlet/http/HttpServlet
我用的是EditPlus软件编译和运行的。
tangwei070 2009-12-28
  • 打赏
  • 举报
回复
up 没错
woxiechenlong 2009-12-28
  • 打赏
  • 举报
回复
图片如下:
学习Java中 2009-12-28
  • 打赏
  • 举报
回复
图片看不到,我用java application运行没有报错

50,503

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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