简体   繁体   中英

Using emmarun (main method not found)

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM