Using emmarun (main method not found)

陌路散爱 提交于 2019-12-02 12:06:49

问题


I have an ultra simple file in an empty directory:

public class Test {
    public static void main(String[] args) {
        System.out.println("Test");
    }
}

And the following works as expected

javac Test.java
java Test
> Test

I am on Mac OS X, using emma-2.0.5312 and java 1.7.0_40

emma.jar has been installed to /Library/Java/Extensions, so this works

java emmarun

(it displays the help for using emmarun)

Next I run

java emmarun -cp . Test

And I get the error:

emmarun: [MAIN_METHOD_NOT_FOUND] application class [Test] does not have a runnable public main() method
Exception in thread "main" com.vladium.emma.EMMARuntimeException: [MAIN_METHOD_NOT_FOUND] application class [Test] 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

What causes this? Clearly it does have a public, accessible main method, so why can't emma find it?


回答1:


As per this link http://vikashazrati.wordpress.com/2011/10/09/quicktip-verifyerror-with-jdk-7/

If I use

java -XX:-UseSplitVerifier emmarun -cp . Test

It works just fine

Apparently there are some changes to the bytecode in this version of java, and emma has not been updated to deal with it.



来源:https://stackoverflow.com/questions/19437050/using-emmarun-main-method-not-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!