Help: ContextClassLoader in jtreg tests
Weijun Wang
weijun.wang at oracle.com
Fri Aug 5 14:19:35 UTC 2011
I have two files: A.java and B.java
/*
* @test
* @build A B
* @run main A
*/
public class A {
public static void main(String[] args) throws Exception {
Class.forName("B", true,
Thread.currentThread().getContextClassLoader());
}
}
public class B {
}
Now jtreg A.java shows:
java.lang.ClassNotFoundException: B
How can I get B visible in A's ContextClassLoader?
Don't tell me to change to Class.forName("B"), that line is copied from
JDK that is called by a real test.
Or, the JDK code itself is problematic and it should fallback to another
ClassLoader?
Thanks
Max
More information about the core-libs-dev
mailing list