Last active
September 3, 2016 01:09
-
-
Save cyberdak/d09aff12f448c3b8c51523c5667f977e to your computer and use it in GitHub Desktop.
network class loader test
This file contains hidden or 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
| package com.cyberdak.stringsearch; | |
| import java.lang.reflect.Method; | |
| import java.net.URL; | |
| import java.net.URLClassLoader; | |
| public class Networ { | |
| public static void main(String[] args) throws Exception { | |
| URLClassLoader loader = new URLClassLoader(new URL[]{new URL("http://localhost:8080/")}); | |
| Class c = loader.loadClass("Test"); | |
| Object o = c.newInstance(); | |
| Method m = c.getMethod("testFunction", null); | |
| m.invoke(o, null); | |
| } | |
| } |
This file contains hidden or 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
| test con | |
| test function |
This file contains hidden or 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
| public class Test { | |
| public void testFunction(){ | |
| System.out.println("test function"); | |
| } | |
| public Test(){ | |
| System.out.println("test con"); | |
| } | |
| public static void main(String[] args) { | |
| System.out.println("main"); | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment