Presentation is loading. Please wait.

Presentation is loading. Please wait.

20-Feb-16 javap. Bytecode Java is compiled into bytecode, which is intermediate between Java and a “real” assembly language To implement Java, it is only.

Similar presentations


Presentation on theme: "20-Feb-16 javap. Bytecode Java is compiled into bytecode, which is intermediate between Java and a “real” assembly language To implement Java, it is only."— Presentation transcript:

1 20-Feb-16 javap

2 Bytecode Java is compiled into bytecode, which is intermediate between Java and a “real” assembly language To implement Java, it is only necessary to implement bytecode, and this is a lot simpler Because Java is now so widespread, many other languages now can be compiled to bytecode Ada, Smalltalk, Lisp, Python (Jython), Ruby (JRuby), undoubtedly others Java’s javap command shows the generated bytecode

3 Example % javac JavapDemoApplication.java % javap -c JavapDemoApplication Compiled from JavapDemoApplication.java public class JavapDemoApplication extends java.lang.Object { public JavapDemoApplication(); public static void main(java.lang.String[]); } Method JavapDemoApplication() 0 aload_0 1 invokespecial #1 4 return Method void main(java.lang.String[]) 0 getstatic #2 3 ldc #3 5 invokevirtual #4 8 return Source: http://www.idevelopment.info/data/Programming/java/miscellaneous_java/Using_javap.html

4 Writing in bytecode Unfortunately, javap doesn’t show you the complete bytecode, only the “interesting” bits It is possible to write and run bytecode programs, using a bytecode assembler called Jasmin Unfortunately, Jasmin is old, not maintained, and hard to find I have a Jasmin plugin for Eclipse, written by a pair of former students, but it’s not “ready for prime time”

5 The End


Download ppt "20-Feb-16 javap. Bytecode Java is compiled into bytecode, which is intermediate between Java and a “real” assembly language To implement Java, it is only."

Similar presentations


Ads by Google