I've got the following code that gives an error when ran with the 2 print statements but when I only do one it runs fine. If I'm correct ldc just pushes the string on the stack, so while invoking the second printline it should still have something on stack.
.class public test
.super java/lang/Object
.method public static main([Ljava/lang/String;)V
.limit stack 5
.limit locals 3
getstatic java/lang/System/out Ljava/io/PrintStream;
ldc "this would work if only this line was printed"
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
ldc "but when trying to print this it says it's not on stack?"
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
return
.end method
Error:
java.lang.VerifyError: (class: test, method: main signature: ([Ljava/lang/String;)V) Unable to pop operand off an empty stack
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main"