黑马程序员技术交流社区
标题:
config.prperties (系统找不到指定的文件。)
[打印本页]
作者:
白倩
时间:
2011-11-1 17:53
标题:
config.prperties (系统找不到指定的文件。)
public class Collections {
public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException {
InputStream is=new FileInputStream("config.prperties");
Properties p=new Properties();
p.load(is);
is.close();
String className=p.getProperty("className");
Collection c=(Collection) Class.forName(className).newInstance();
//Collection c=new HashSet();
ReflactPoint r1=new ReflactPoint(3,5);
ReflactPoint r2=new ReflactPoint(4,5);
ReflactPoint r3=new ReflactPoint(3,7);
c.add(r1);
c.add(r2);
c.add(r3);
c.add(r1);
System.out.println(c.size());
}
}
这个我不知道哪写错了,希望大家帮忙看看,config.prperties文件写在项目目录下跟Src同级
作者:
白倩
时间:
2011-11-1 17:59
找到了,又是自己的粗心把单词拼错了!哎!
作者:
张冬冬
时间:
2011-11-1 21:04
女女、你不能总这样啊,这样粗心以后代码行数多了的话,可怎么办啊。要仔细些才好啊。
作者:
罗亚东
时间:
2011-11-1 21:10
你的properties写错了
作者:
白倩
时间:
2011-11-1 21:55
张冬冬 发表于 2011-11-1 21:04
女女、你不能总这样啊,这样粗心以后代码行数多了的话,可怎么办啊。要仔细些才好啊。 ...
知道了,以后会多加注意的,呵呵
作者:
杨玉揆
时间:
2011-11-1 23:08
就这样才能进步的 呵呵 加油
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2