当前位置: 代码迷 >> Java相关 >> 求好手解答
  详细解决方案

求好手解答

热度:2363   发布时间:2013-02-25 21:49:57.0
求高手解答
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;

public class test {
public void testStream() throws Exception {
FileInputStream fis = null;
InputStreamReader isr = null;
BufferedReader br = null;
try {
fis = new FileInputStream(new File("F:\\test.txt"));
isr = new InputStreamReader(fis);
br = new BufferedReader(isr);

String str = null;
while ((str = br.readLine()) != null) {
String str2 = str.replace("\\bnwe\\b", "new");
System.out.println(str2);
}
} catch (Exception e) {
e.printStackTrace();

} finally {
if (br != null) {
br.close();
}
if (isr != null) {
isr.close();

}
if (fis != null) {
fis.close();
}
}

}
}
执行的时候出错 提示如下:
java.lang.NoClassDefFoundError: test
Caused by: java.lang.ClassNotFoundException: test
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Exception in thread "main"

------解决方案--------------------------------------------------------
类名 注意需要大写
  相关解决方案