0

I'm trying to use Emma coverage tool with Eclipse, but i'm a little confused.

So I added emma.jar and emma_ant.jar into /usr/lib/jvm/java-6-openjdk-common/jre/lib/ext/emma/ directory and created a Java Project under Eclipse using JRE: java-6-openjdk

I copied a build.xml example file into my project and edited the emma.dir property to /usr/lib/jvm/java-6-openjdk-common/jre/lib/ext/emma/

Then, when I create a .jar file, and try to run it with Emma:

java emmarun -jar HelloWorld.jar

I get this:

Exception in thread "main" java.lang.NoClassDefFoundError: emmarun Caused by: java.lang.ClassNotFoundException: emmarun at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) Could not find the main class: emmarun. Program will exit.

Thanks for your help!

kdelemme
  • 333
  • 1
  • 7
  • 20

2 Answers2

0

You are doing it the hard way. Install the EclEmma plugin and you just have to select the correct launch configuration to get test coverage.

Update: I just realized that EclEmma uses JaCoCo internally, and no longer Emma. Still, it's a great tool, I'd go with it nevertheless.

But to solve your problem: I don't think you can have subfolders in lib/ext. Move the jar directly inside lib/ext and it should work.

Sean Patrick Floyd
  • 292,901
  • 67
  • 465
  • 588
0

Just install ecl-emma through the eclipse install center!

Go on Help -> Install Software, insert there the ecl-emma page:

http://update.eclemma.org/

And go through the the installation assistant.

panmari
  • 3,627
  • 3
  • 28
  • 48