Created
April 10, 2020 19:11
-
-
Save nipunthathsara/5786f1933c43d68fae4b3361e79fb5cf to your computer and use it in GitHub Desktop.
URLClassLoader.java - Loading *.class files
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
... | |
protected Class<?> findClass(final String name) | |
throws ClassNotFoundException | |
{ | |
final Class<?> result; | |
try { | |
result = AccessController.doPrivileged( | |
new PrivilegedExceptionAction<>() { | |
public Class<?> run() throws ClassNotFoundException { | |
String path = name.replace('.', '/').concat(".class"); | |
Resource res = ucp.getResource(path, false); | |
if (res != null) { | |
try { | |
return defineClass(name, res); | |
} catch (IOException e) { | |
throw new ClassNotFoundException(name, e); | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment