I am using ant 1.3 junit 3.5 and sun jdk 1.3 for linux. If i use the junit
task to run a test under ant, the code cannot load the resource I specify - I
just get null returned from ...
System.out.println("System classloader");
System.out.println(ClassLoader.getSystemResourceAsStream(RESOURCE_NAME));
...or...
ClassLoader classLoader = Thread.currentThread()
.getContextClassLoader();
System.out.println(" classloader="+classLoader);
System.out.println(classLoader.getResourceAsStream(RESOURCE_NAME));
If i run the unit test from the command line with something like...
java -cp ../build/classes:../build/test/classes/:lib/junit.jar...etc...
junit.textui.TestRunner MyTest
then the system classloader works and finds the resource (although I cannot
get the current Thread's class loader to work).
In case its relevant, I am trying to load the resource in a static code
that gets run when my class loads.
Can anyone help???
Thanks, Matty.