set main thread context classloader correctly for OpenJDK port

sun.misc.Launcher has its own idea about what the application
classloader should be, but we need to override it with the system
classloader created by the VM.  This is achieved by running
Launcher.getLauncher (which has the side effect of setting
Thread.contextClassLoader) and then overriding it.
This commit is contained in:
Joel Dice 2012-08-29 18:27:37 -06:00
parent c2b53497ab
commit 8c48a44e54

View File

@ -623,6 +623,13 @@ class MyClasspath : public Classpath {
t->m->processor->invoke
(t, root(t, Machine::BootLoader), "java/lang/System",
"initializeSystemClass", "()V", 0);
t->m->processor->invoke
(t, root(t, Machine::BootLoader), "sun/misc/Launcher",
"getLauncher", "()Lsun/misc/Launcher;", 0);
set(t, t->javaThread, ThreadContextClassLoader,
root(t, Machine::AppLoader));
}
virtual const char*