String fileName = "/config/abcd.config";
InputStream in = getClass().getResourceAsStream(fileName);
BufferedReader br = null;
try{
br = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = br.readLine()) != null){
System.out.println(line);
}
br.close();
} catch (Exception e){
// TODO Auto-generated catch block
e.printStackTrace();
} finally{
if (br != null){
try{
br.close();
} catch (IOException e){
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhaosen241/archive/2009/09/24/4587701.aspx
读取jar包中的配置文件
最新推荐文章于 2024-04-13 04:05:02 发布