static Method printlnMethod = ClassType.make("java.io.PrintStream")
.getDeclaredMethod("println",
new gnu.bytecode.Type[] { gnu.bytecode.Type.string_type });
static byte[] gnuByteCodeHelloWorld() {
ClassType c = new ClassType("HelloWorld");
c.setSuper("java.lang.Object");
c.setModifiers(Access.PUBLIC);
c.setSourceFile("HelloWorld.java");
Method m = c.addMethod("<init>", "()V", Access.PUBLIC);
CodeAttr code = m.startCode();
code.pushScope();
code.emitPushThis();
code.emitInvokeSpecial(objectCtor);
code.emitReturn();
code.popScope();
m = c.addMethod("main", "([Ljava/lang/String;)V", Access.PUBLIC
| Access.STATIC);
code = m.startCode();
code.pushScope();
code.emitGetStatic(outField);
code.emitPushString("Hello world!");
code.emitInvokeVirtual(printlnMethod);
code.emitReturn();
code.popScope();
return c.writeToArray();
}