Emma代码覆盖率工具错误 - 未找到主要方法

时间:2017-02-11 00:03:42

标签: java intellij-idea jar emma

我正在使用Emma代码覆盖工具,我有Java8。我是Emma的新手,并且提供的帮助非常少。我尝试使用以下链接。

  1. http://emma.sourceforge.net/intro.html
  2. http://users.csc.calpoly.edu/~jdalbey/309/Lectures/emmademo.html
  3. 但是当我尝试运行时,我一直收到以下错误:

    java -cp emma.jar emmarun -jar .../jdk1.4.2/demo/jfc/SwingSet2/SwingSet2.jar 
    java -cp TestTools\emma.jar;. emmarun -cp . CircleConverter 
    

    我也尝试了here的选项,但它没有帮助。

    错误是 -

    CoverageDemo>java -XX:-UseSplitVerifier -cp TestTools\emma.jar;. emmarun -cp . CircleConverter
    Java HotSpot(TM) 64-Bit Server VM warning: ignoring option UseSplitVerifier; support was removed in 8.0
    EMMA: no coverage data collected at runtime [all reports will be empty]
    EMMA: writing [txt] report to [C:\Users\pkothavale\Downloads\CoverageDemo\coverage.txt] ...
    [EMMA v2.0, build 4217]
    emmarun: [MAIN_METHOD_NOT_FOUND] application class [CircleConverter] does not have a runnable public main() method
    Exception in thread "main" com.vladium.emma.EMMARuntimeException: [MAIN_METHOD_NOT_FOUND] application class [CircleConverter] 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
    Exception Details:
    

1 个答案:

答案 0 :(得分:1)

事实上,问题是由于这一行:

Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 11

我找到了这个链接的解决方案:java.lang.VerifyError: Expecting a stackmap frame at branch target JDK 1.7

但简而言之,java7引入了更严格的验证并禁用它,我们可以添加选项" -XX:-UseSplitVerifier"如果您使用的是java7或" -noverify"如果你在java8。

因此java8的正确命令行是:

java -noverify -cp emma.jar emmarun -jar .../jdk1.4.2/demo/jfc/SwingSet2/SwingSet2.jar