顶一下。关于XML文件的访问应该经常用到的吧?

解决方案 »

  1.   

    //得到与当前文件对应的.class文件的上一级目录路径        URL url = this.getClass().getResource("LogQueryApp.class");
            String sPath = url.getPath();
            int index=sPath.lastIndexOf("/");
            sPath=sPath.substring(0,index);
            index=sPath.lastIndexOf("/");
            sPath=sPath.substring(0,index+1);
            strPath=sPath.substring(1);
            jComboBox_sProgramName_final(this.strPath+"edition.xml");
      

  2.   

    request.getSession().getServletContext().getRealPath("/WEB-INF/");用这个方法来取得目前的WEB-INF目录的绝对地址,然后就可以再拼上相对地址来取得你需要的目录