URL[] urls = new URL[1];
URLStreamHandler streamHandler = null;
File classPath = new File(Constants.WEB_ROOT);
String repository = (new URL("file", null, classPath.getCanonicalPath() + File.separator)).toString() ;
urls[0] = new URL(null, repository, streamHandler);
loader = new URLClassLoader(urls);
为什么要将一个URL嵌套在URL中,不能直接用被嵌套的那个吗?
也就是这样用urls[0] = new URL("file", null, classPath.getCanonicalPath() + File.separator) ;
这样不也能找到servlet所在的地址吗?