J2EE 读取文件路径

    在J2ee中实现java类读取webcontent/web-inf/config.xml的实现代码 ,其中../config.xml相对于classes的路径

 

            java.net.URL url = this.getClass().getClassLoader().getResource("../config.xml");
            File xmlFile = new File(url.toURI().getPath());    


 

posted @ 2014-04-16 16:43  wala-wo  阅读(135)  评论(0编辑  收藏  举报