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

properties文件路径的读取

2015-08-04 22:34 399 查看
System.out.println(System.getProperty("user.dir")); //这个是去工程的绝对路径的
System.out.println(Thread.currentThread().getContextClassLoader().getResource(""));//这个是去当前classpath的uri的!
new Properties().load(new FileInputStream("test.properties"));//这里说明test文件在工程的跟目录下!
new Properties().load(new FileInputStream("test/test.properties"));//说明,在工程底下的test的文件夹底下的文件test.properties!
ResourceBundle rs = ResourceBundle.getBundle("org.hello");
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: