您的位置:首页 > 运维架构

取不同包目录下面的properties文件内容

2012-08-22 13:47 113 查看
public static void main(String[] args) throws IOException {

        Properties p = new Properties();

        String is = Test.class.getClassLoader().getResource("").getPath();

        System.out.println(is + "domain.properties");

        InputStream inputStream = new FileInputStream(is + "domain.properties");

        p.load(inputStream);

        String p1 = p.getProperty("jdbc.driverClass").trim();

        System.out.println(p1);

        String p2 = p.getProperty("jdbc.url").trim();

        System.out.println(p2);

    }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  properties string
相关文章推荐