#119 access to resources is confused

Vlad Roubtsov
CORE (51)
Paul Millar


I\'m attempting to use emma in a fairly large project. I would like not to have to make a custom build of the project, so I\'m attempting to use the emmarun command for on-the-fly instrumentation and reporting.

I am having difficulties that I believe are the result of some issues with the custom classloader. There are two issues that may be related.

Both descriptions use the following example invocation of emmarun:

java -cp foo.jar:emma.jar emmarun -cp bar.jar MyClass

The first problem is that code loaded from the system classloader cannot find resources present in the \"-cp\" option of emmarun. So code in foo.jar cannot find a resource located in bar.jar.

The second problem is the converse: code loaded from the emma custom classloader cannot find resources located in the system classloader: code in bar.jar cannot find a resource located in foo.bar

There is a simple work-around to the first problem: those jar files that contain resources can be placed in the system classloader. For example:

java -cp foo.jar:bar.jar:emma.jar emmarun -cp bar.jar MyClass

It may be that the first problem is an architectural limitation of Java and how emma is structure; so I\'m happy enough with the work-around.

However, the second problem is likely to be due to some bug in the custom classloader and, since there doesn\'t seem to be a work-around, it should be fixed.

If it helps, I\'ve written a short example (attached) to demonstrate the two problems and the work-around to the first problem. Invoke \"ant\" to see a demonstration.


  • Paul Millar
    Paul Millar

    test-case to demonstrate the problem

  • Paul Millar
    Paul Millar

    Sorry, forgot to add some details: the version of emma is 2.0.5312 and I've tried with both OpenJDK v6-b18 (Debian pkg 6b18-1.8.1-1) and various versions of Sun's JDK v6.