Dowemo
0 0 0 0

For android applications, the java file in the program is compiled into the class file, while it'll be optimized for internal optimization, compressed, packaged into.
This article provides three convenient ways to view byte code.

Assume that there's a hello. Java file in the local d tray:

publicclass Hello
{
 publicvoidsay(){
 Hello he = new Hello();
 System.out.println("hello world");
 }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

First use the command Javac D:Hello. java A java file is compiled into the hello. Class file, which can be opened directly by using the pooled gui. Exe program, or open with the ide tool ( such as as ), but the hello. Class file that appears is the same as the original java file. It isn't the format we want to see. At this point, Javap -c D:Hello. class You can see the bytecode file we need in the dos window:

publicclass Hello {
 publicHello();
 Code:
 0: aload_0
 1: invokespecial #1 4: returnpublicvoidsay();
 Code:
 0: new#2//class Hello3: dup
 4: invokespecial #3//Method"<init>":()V7: astore_1
 8: getstatic #4 11: ldc #5//String hello world13: invokevirtual #6 16: return}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

How tools

Assume that there's a hello. Java file in the local d tray, similar to the description above to compile the hello. Class file ( or find those. Class files in the related out folder in the ide ), then download the java bytecode to see the UI panel, and see the class information to see a directory that looks like the following.
这里写图片描述

How internal tools

The above two approaches go out of the ide and sometimes take a bit more time. We need a suitable, thanks to jclasslib bytecode viewer, we open the ide ( here's schmidt studio ), setting-plugin-browse. -bytecode viewer-jclasslib bytecode viewer-install-restart, and then open a java file, then view show bytecode with jclasslib on the right side of the ide, which will see an interface similar to the following:

这里写图片描述

Above above.




Copyright © 2011 Dowemo All rights reserved.    Creative Commons   AboutUs