I'm facing a problem that I think I'm not using the right terms to search for a solution.
So, I have bytecode in the form of text (String), like below:
public class HelloWorld {
public HelloWorld();
Code:
0: aload_0
1: invokespecial #1 // Method java/lang/Object."<init>":()V
4: return
public static void main(java.lang.String[]);
Code:
0: iconst_0
1: istore_1
2: iinc 1, 1
5: getstatic #2 // Field java/lang/System.out:Ljava/io/PrintStream;
8: new #3 // class java/lang/StringBuilder
11: dup
12: invokespecial #4 // Method java/lang/StringBuilder."<init>":()V
15: ldc #5 // String Hello World
17: invokevirtual #6 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
20: iload_1
21: invokevirtual #7 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
24: invokevirtual #8 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
27: invokevirtual #9 // Method java/io/PrintStream.println:(Ljava/lang/String;)V
30: return
}
Now I need to compile it to a .class file.
I looked at ASM, Jasmin and other assembler tools, but could not figure out a proper solution. What I understood from these tools is that you write a program in a specific instruction set language and it transforms it to a binary file. But what I'm looking for is using JVM own regular instruction set.
I appreciate any help.