Search code examples
javajvmjasmin

Getting a ClassFormatError in Jasmin


I'm trying to create a program that would print some text using jasmin. This is a piece of the whole code:

    zfor:
        1 iload 3 ; pushes z to stack
        2 iload 1 ; pushes i to stack
        3 if_icmpge nextfor ; if (z>=i) goto nextfor
        4 getstatic java/lang/System/out Ljava/io/PrintStream 
        5 ldc "O"  ; push string constant
        6 invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
        7 iinc 3 1 ; z++
        8 goto zfor

after compiling, i'm getting this error:

    Error: A JNI error has occurred, please check your installation and try again.
    Exception in thread "main" java.lang.ClassFormatError: Field "out" in class examples/Triangle has illegal signature "Ljava/io/Printstream"

it seems like the error is somewhere in line 4, since, after making that line as a comment i'm not getting any errors.


Solution

  • Add ; to the signature: Ljava/io/PrintStream;