Topic: 帮忙找下错误在哪里?(系统找不到指定的文件)

  Print this page

1.帮忙找下错误在哪里?(系统找不到指定的文件) Copy to clipboard
Posted by: baler
Posted on: 2006-11-09 10:28


public class IOStreamDemo {
public static void main(String [] args)throws IOException{
BufferedReader in = new BufferedReader(new FileReader("IOStreamDemo.java"));
String s,s2= new String();
while((s = in.readLine())!=null){
s2=s+s2+"\n";
}
in.close();
}
}

Exception in thread "main" java.io.FileNotFoundException: IOStreamDemo.java (系统找不到指定的文件。)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at java.io.FileReader.<init>(FileReader.java:41)
at text11_07.IOStreamDemo.main(IOStreamDemo.java:9)

2.Re:帮忙找下错误在哪里? [Re: baler] Copy to clipboard
Posted by: kingecg
Posted on: 2006-11-09 13:01

类路径设对了没有。要把当前路径也接加进去

3.Re:帮忙找下错误在哪里? [Re: baler] Copy to clipboard
Posted by: bd0571
Posted on: 2006-11-13 19:24

你需要读入一个文件,就要在工程目录下新建那个文件才行。你现在的这个文件:IOStreamDemo.java,可能生成的不在工程目录下,你只要把文件拷的工程那个目录下就可以了。如果你用的是ECLIPSE,你只要把那个文件和".project"文件放一起就好了。

4.Re:帮忙找下错误在哪里?(系统找不到指定的文件) [Re: baler] Copy to clipboard
Posted by: baler
Posted on: 2006-11-14 18:40

恩,我是包里的,终于找到错误了,谢谢


   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