获取 .properties 配置文件中的值

public static String getPath() {
  String path = "";
  Properties prop = new Properties();
        try {
         InputStream in = ImageURL.class.getClassLoader().getResourceAsStream("jdbc.properties");
            prop.load(in);
            
            path = prop.getProperty("admin.path");
            
            in.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return path;
 }

版权声明:本文为博主原创文章,未经博主允许不得转载。

posted @ 2013-02-21 21:26  一直向北  阅读(112)  评论(0编辑  收藏  举报