java读取配置文件里的信息

来源:互联网 发布:手机淘宝怎样修改星评 编辑:程序博客网 时间:2024/05/01 14:42
@Get("Unit")public String Unit() throws IOException {InputStream in = new BufferedInputStream(new FileInputStream("D:/newworkSpace/myeclipse/fanyazhongxiaoxue/config/config.properties"));ResourceBundle rb = new PropertyResourceBundle(in);String a = rb.getString("sqlUrl");System.out.println(a);return "createUnit";}
1.想请问如何吧 文件路径给成相对路径?这样就可以把获取配置文件中的信息写活,否则部署到服务器上,肯定会报‘系统找不到指定文件’.望看到的可以提示下.