Topic: java.io.IOException: 句柄无效???

  Print this page

1.java.io.IOException: 句柄无效??? Copy to clipboard
Posted by: aideliwu
Posted on: 2004-09-01 14:15

我还是被

Exception in thread "main" Exit code: 1
There were errors

这个错误迷惑着啦,你能帮帮我吗,有人说我的 main 方法中

代码有误,可是我编译可以通过呀,但运行出错啦呀.

请帮我留意一下我的代码,耐心看一看,先谢谢你啦:

import java.io.*;
public class NumberInput{
public static void main(String args[]) throws IOException
{
String s;
InputStreamReader ir=new InputStreamReader(System.in);
BufferedReader in=new BufferedReader(ir);
s=in.readLine();
System.out.println("Input value is: "+s);
int i=Integer.parseInt(s);
i*=2;
System.out.println ("Input value changed after doubled:"+i);
}
}

呵呵呵呵~辛苦啦~~帮帮我哦~~给我些解决的提示哈,

等待你的回音,^-^~^-^~




Please try to use the Edit function and check "Disable Smileys".
I have corrected the typo for you.

啊啊啊~`我的代码~在我提交时~不小心~错啦一点小错误啦:
上代码中的 i=intInteger.parseInt(s);
在我原代码中是int i=Integer.parseInt(s);啦.

main中的错误应该是在其他地方啦~

2.Re:java.io.IOException: 句柄无效??? [Re: aideliwu] Copy to clipboard
Posted by: xiaopa
Posted on: 2004-09-01 14:34

windowsXP + JDK1.4.2 正常执行完毕

3.Re:java.io.IOException: 句柄无效??? [Re: aideliwu] Copy to clipboard
Posted by: 七品县令
Posted on: 2004-09-01 17:28

执行正常亚

4.Re:java.io.IOException: 句柄无效??? [Re: aideliwu] Copy to clipboard
Posted by: aideliwu
Posted on: 2004-09-01 21:32

我思考le很久,也查看啦代码很久,可还是百思不得其解,
在Freejava中运行的结果还是:
java.io.IOException: 句柄无效。
  at java.io.FileInputStream.readBytes(Native Method)
  at java.io.FileInputStream.read(FileInputStream.java:191)
  at java.io.BufferedInputStream.read1(BufferedInputStream.java:220)
  at java.io.BufferedInputStream.read(BufferedInputStream.java:277)
  at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:406)
  at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:446)
  at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:180)
  at java.io.InputStreamReader.read(InputStreamReader.java:167)
  at java.io.BufferedReader.fill(BufferedReader.java:136)
  at java.io.BufferedReader.readLine(BufferedReader.java:299)
  at java.io.BufferedReader.readLine(BufferedReader.java:362)
  at NumberInput.main(NumberInput.java:9)
Exception in thread "main" Exit code: 1
There were errors

对于我来说,这样de提示问题真de可大le,为什么会句柄无效呢??我只是用啦:
InputStreamReader(System.in);
我访问de资源是什么呢???为什么会无效呢????
at java.io.FileInputStream.read(FileInputStream.java:191)
其中de参数怎么是FileInputStream.java:191呢?? ":191"又是什么呀???
哎~望你能不吝赐教,不厌我烦de给一个迷糊中de菜鸟提示,
再次感谢你,你的帮助会使我在java路上少走好多弯路,剩好多时间de.

5.Re:java.io.IOException: 句柄无效??? [Re: aideliwu] Copy to clipboard
Posted by: aideliwu
Posted on: 2004-09-02 22:51

哪位高手~~真de真de~耐心看一下我de问题呀~

城心希望能得到你de帮助

期待你de回音

6.Re:java.io.IOException: 句柄无效??? [Re: aideliwu] Copy to clipboard
Posted by: why
Posted on: 2004-09-03 03:20

试试重装 J2SDK 吧

7.Re:java.io.IOException: 句柄无效??? [Re: why] Copy to clipboard
Posted by: aideliwu
Posted on: 2004-09-03 09:02

~恩恩~~~~~~对~~~~有其他人说可以运行啦~

~我试试~重装哈~~~~

~谢谢啦~~~~~~問題兒童 ~^-^~~

8.Re:java.io.IOException: 句柄无效??? [Re: aideliwu] Copy to clipboard
Posted by: why
Posted on: 2004-09-03 09:21

>> 有人说我的 main 方法中代码有误
不是有误,也是有误

不是句法有误
但是 main 方法 throws IOException
查一查,throws IOException 有甚么作用;
想一想,这合理吗?


似乎阁下已经设置好 JDK,于此应该不再有问题吧。

敝人不常在 J2SE 版出现,有事勿找敝人。Smile
(这裡有不少热心助人的会员,多向大家学习好了。
当然,先搜尋旧帖子。)
)

9.Re:java.io.IOException: 句柄无效??? [Re: aideliwu] Copy to clipboard
Posted by: aideliwu
Posted on: 2004-09-03 09:21

~呵呵呵呵~~谢谢你啦~~~why~~~~

~我de问题已经在你de帮助下解决啦~

~希望在以后de时间li你能~更多de注意我de问题~多给我帮助哈~~~

~~~^_^~^_^~~~~


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923