MCPcopy Create free account
hub / github.com/JavaCourse00/JavaCourseCodes / main

Method main

01jvm/TestAddUrl.java:9–20  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

7public class TestAddUrl {
8
9 public static void main(String[] args) throws Exception {
10 URLClassLoader classLoader = (URLClassLoader) TestAddUrl.class.getClassLoader();
11 String dir = "./lib";
12 Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
13 method.setAccessible(true);
14 method.invoke(classLoader, new File(dir).getAbsoluteFile().toURL());
15
16 Class klass = Class.forName("HelloKimmking",true, classLoader);
17 Object obj = klass.newInstance();
18 Method hello = klass.getDeclaredMethod("hello");
19 hello.invoke(obj);
20 }
21
22}

Callers

nothing calls this directly

Calls 1

invokeMethod · 0.45

Tested by

no test coverage detected