jasmin这个工具,用它写了一个HelloWorld程序,因为使用正常的javac编译得到的class文件确定是正确的,使用jasmin估计可以设计一些非法的class文件。
HelloWorld的代码:
.class public HelloWorld
.super java/lang/Object
;specify the constuctor method for the Example class
.method public <init>()V
;just call Object's constructor
aload_0
invokespecial java/lang/Object/<init>()V
return
.end method
;specify the "main" method -this prints "Hello World"
.method public static main([Ljava/lang/String;)V
;set limmits used by this method
.limit stack 2
;push the output stream and the string "Hello World " onto the stack
;then invoke the println method
getstatic java/lang/System/out Ljava/io/PrintStream;
ldc "Hello World!"
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V
return
.end method
这样看太累了,希望不忙的时候能够开发个相关的插件。
责任编辑:小草