GHawk

2006年1月19日 #

加载Classpath中的文件(转)

   URL url = this.getClass().getResource("EJBConfig.xml");
        
try {
            File xmlFile 
= new File(URLDecoder.decode(url.getFile(),"UTF-8"));
            
if(xmlFile.exists())
                System.out.println(
"OK");
        } 
catch (UnsupportedEncodingException e) {
            e.printStackTrace();  
//To change body of catch statement use File | Settings | File Templates.
        }

posted @ 2006-01-19 22:07 GHawk 阅读(298) | 评论 (0)编辑 收藏