Search code examples
javaemmaemmarun

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?


Solution

  • 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.