无法运行EMMA代码覆盖率

时间:2012-04-25 13:37:31

标签: java code-coverage emma

我安装了Java SE Development Kit 7u3

我已经完成了一些与此相似的主题(e.x. "java" succeeds," java emmarun" fails)但我的问题是EMMA根本不适合我。我跑完之后:

java -cp emma.jar emmarun -cp . Main

总是说:

[EMMA v2.0, build 5312]
emmarun: [MAIN_METHOD_NOT_FOUND] application class [Main] does not have a runnable public main() method
Exception in thread "main" com.vladium.emma.EMMARuntimeException: [MAIN_METHOD_NOT_FOUND] application class [Main] does not have a runnable public main() method
        at com.vladium.emma.rt.AppRunner._run(AppRunner.java:497)
        at com.vladium.emma.rt.AppRunner.run(AppRunner.java:97)
        at com.vladium.emma.runCommand.run(runCommand.java:247)
        at emmarun.main(emmarun.java:27)
Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 11 in method Main.<init>()V at offset 4
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at com.vladium.emma.rt.AppRunner._run(AppRunner.java:493)

编译运行良好(“javac Main.java”)并且应用程序正在运行(我从“java Main”获得预期的输出)。 Main.java的代码是简单的HelloWorld应用程序。

public class Main{

public static void main(String[] args) {
    System.out.println("Hello, World");
}

我只想在任何示例代码上运行emmarun以查看它是否正常工作。嗯,事实并非如此。关于我做错了什么想法?

1 个答案:

答案 0 :(得分:1)

这似乎突然出现在一些地方。到目前为止我发现的解决方案是: