GHawk

加载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 on 2006-01-19 22:07 GHawk 阅读(747) 评论(0)  编辑  收藏 所属分类: 代码碎片


只有注册用户登录后才能发表评论。


网站导航: