blob: 90b7958989e3bdf6111bd1eb5fb8ca04dac7d8ba (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package dotty.tools.vulpix;
import java.io.File;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.lang.reflect.Method;
public class ChildJVMMain {
static final String MessageEnd = "##THIS IS THE END FOR ME, GOODBYE##";
private static void runMain(String dir) throws Exception {
ArrayList<URL> cp = new ArrayList<>();
for (String path : dir.split(":"))
cp.add(new File(path).toURI().toURL());
URLClassLoader ucl = new URLClassLoader(cp.toArray(new URL[cp.size()]));
Class<?> cls = ucl.loadClass("Test");
Method meth = cls.getMethod("main", String[].class);
Object[] args = new Object[]{ new String[]{ "jvm" } };
meth.invoke(null, args);
}
public static void main(String[] args) throws Exception {
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
while (true) {
runMain(stdin.readLine());
System.out.println(MessageEnd);
}
}
}
|