java abstract catch finally_Java开发网 - 这段程序哪里错了?('try' without 'catch' or 'finally')...

Posted by:yangxg_a

Posted on:2005-11-27 13:59

下面这段程序哪里错了啊?

int number=0;

File file=new File("count.txt");

synchronized void countPeople()//计算访问次数的同步方法

{

if(!file.exists())

{

number++;

try{

file.createNewFile();

FileOutputStream Out=new FileOutputStream("count.txt");

DataOutputStream dataOut=new DataOutputStream(out);

dataOut.writeInt(number);

out.close();

dataOut.close();

}

catch(IOException ee){}

}

else

{

try{

FileInputStream in=new FileInputstream("count.txt");

DataInputStream dataIn=new DataInputStream(in);

number=dataIn.readInt();

number++;

in.close();

dataIn.close();

FileOutputStream out=new FileOutputStream("count.txt");

DataOutputStream dataOut=new DataOutputStream(out);

dataOut.writeInt(number);

out.close();

dataOut.close();

}

}

catch(IOException ee){}

}

}

%>

countPeople();

%>

您是第

个访问本站的客户。

错误提示是:

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

An error occurred at line: 5 in the jsp file: /Example2_3.jsp

Generated servlet error:

E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:31: 'try' without 'catch' or 'finally'

try{

^

An error occurred at line: 5 in the jsp file: /Example2_3.jsp

Generated servlet error:

E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:45: 'catch' without 'try'

catch(IOException ee){}

^

Generated servlet error:

E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:49: 'class' or 'interface' expected

private static java.util.Vector _jspx_dependants;

^

Generated servlet error:

E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:51: 'class' or 'interface' expected

public java.util.List getDependants() {

^

Generated servlet error:

E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:111: 'class' or 'interface' expected

}

^

Generated servlet error:

E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:112: 'class' or 'interface' expected

^

Generated servlet error:

E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:8: org.apache.jsp.Example2_005f3_jsp should be declared abstract; it does not define getDependants() in org.apache.jsp.Example2_005f3_jsp

public final class Example2_005f3_jsp extends org.apache.jasper.runtime.HttpJspBase

^

An error occurred at line: 5 in the jsp file: /Example2_3.jsp

Generated servlet error:

E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:22: cannot resolve symbol

symbol : variable out

location: class org.apache.jsp.Example2_005f3_jsp

DataOutputStream dataOut=new DataOutputStream(out);

^

An error occurred at line: 5 in the jsp file: /Example2_3.jsp

Generated servlet error:

E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:24: cannot resolve symbol

symbol : variable out

location: class org.apache.jsp.Example2_005f3_jsp

out.close();

^

An error occurred at line: 5 in the jsp file: /Example2_3.jsp

Generated servlet error:

E:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\Example2_005f3_jsp.java:32: cannot resolve symbol

symbol : class FileInputstream

location: class org.apache.jsp.Example2_005f3_jsp

FileInputStream in=new FileInputstream("count.txt");

^

10 errors

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)

org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)

org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值