Jasmin Assembler verifyError:期望在堆栈上找到对象/数组
我在“java testphase”之后收到此错误:
C:\jasmin-2.4>java testphase
Exception in thread "main" java.lang.VerifyError:
(class: testphase, method: main signature: ([Ljava/lang/String;)V)
Expecting to find object/array on stack
Could not find the main class: testphase.
Program will exit.
代码:
.class public testphase
.super java/lang/Object
; standard initializer
.method public <init>()V
aload_0
invokenonvirtual java/lang/Object/<init>()V
return
.end method
.method public static main([Ljava/lang/String;)V
.limit stack 10
.limit locals 3
; assign something
iconst_1
iconst_1
iadd
istore_1
; assign something
iconst_2
iconst_2
isub
istore_2
; Writeln
getstatic java/lang/System/out Ljava/io/PrintStream;
iload_1
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
return
.end method
I get this error after "java testphase":
C:\jasmin-2.4>java testphase
Exception in thread "main" java.lang.VerifyError:
(class: testphase, method: main signature: ([Ljava/lang/String;)V)
Expecting to find object/array on stack
Could not find the main class: testphase.
Program will exit.
Code:
.class public testphase
.super java/lang/Object
; standard initializer
.method public <init>()V
aload_0
invokenonvirtual java/lang/Object/<init>()V
return
.end method
.method public static main([Ljava/lang/String;)V
.limit stack 10
.limit locals 3
; assign something
iconst_1
iconst_1
iadd
istore_1
; assign something
iconst_2
iconst_2
isub
istore_2
; Writeln
getstatic java/lang/System/out Ljava/io/PrintStream;
iload_1
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
return
.end method
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你有多个问题。
首先:您需要将最终的
iload_1
更改为
aload_1
其次,您加载的是字符串数组,而不是字符串。您需要选择您想要的元素。 (查找 aaload 了解如何取消引用数组中的元素。)
您需要先修复这两个问题,然后才能真正起作用。
You've got multiple issues.
First: you need to change the final
iload_1
to be
aload_1
Second, you're loading a String array, not a String. You need to choose which element you want. (look up aaload for how to dereference elements in the array.)
You need to fix both before it'll actually work.
这将起作用:
基本上,更改在于 System.out.println(int) 的签名。
This will work:
Basically the change consists in the signature of
System.out.println(int)
.