加载Classpath中的文件

加载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.
        }


你可能感兴趣的:(加载Classpath中的文件)