Last active
December 26, 2015 02:19
-
-
Save cloudhuang/7077578 to your computer and use it in GitHub Desktop.
URL class loader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URLClassLoader classLoader = null; | |
try { | |
// create url class loader to load the servlet class | |
URL[] urls = new URL[1]; | |
URLStreamHandler urlStreamHandler = null; | |
File classPath = new File(Constents.WEB_ROOT); | |
String repository = (new URL("file", null, classPath.getCanonicalPath() + File.separator)).toString(); | |
urls[0] = new URL(null, repository, urlStreamHandler); | |
classLoader = new URLClassLoader(urls); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment