Class.getResourceAsStream

Class.getResourceAsStream("abc.properties")方法:
1,如果使用“/”开头则从类路径根目录寻找资源;
2,没有“/”开头,则选择相对路径,即当前class同包下面找;

ClassLoader.getResourceAsStream("abc.properties"):
1,不能用“/”开头,只能从根目录寻找。
2,根据不同ClassLoader实现也不一样。

posted on 2013-04-06 14:09  子非鱼焉  阅读(87)  评论(0编辑  收藏  举报

导航