View Java bytecode Directive information under MyEclipse

Source: Internet
Author: User

In the actual project development, sometimes in order to understand some of the Java compiler internal work, need to see the Java file corresponding to the specific bytecode instruction set, there are two ways for reference. first, using the JAVAP commandJAVAP is a native tool provided by the JDK, it can disassemble the class file to get corresponding bytecode information, by adjusting the command parameters, you can obtain the class of package, fileds and methods and other bytecode information, with the most parameters that is-verbose: second, bytecode outline plug-inJAVAP is possible to achieve the effect of anti-compilation bytecode, but every time to execute in the command line, it seems a bit troublesome, and through the anti-compilation generated instructions is simply not for people to see, basically do not understand. A tool bytecode Outline is recommended here, which is an anti-compile plugin specifically for Eclipse, which not only allows you to view the set of bytecode instructions generated by the decompile, but also provides a detailed description of all instructions.    First install the plugin in MyEclipse need to know myeclipse corresponding Eclipse version number, you can view the following file get: D:\MyEclipse\MyEclipse 10\readme\readme_eclipse.html Then is the download installs the plug-in, here does not introduce, if is installs manually, here provides the plug-in: http://andrei.gmxhome.de/bytecode/links.html about the use of the plug-in, the official document said very clearly, I do not translate:
Usage:1)Windows---Show View--Java-bytecode

To see bytecode of the current Java editor/class file view. The automatic build for projects should is enabled with order to see generated class files.

If "Link with editor" was on, then any selection in Java editor would be followed with selection of appropriated bytecode LA Bel, and Vice-versa.

Note:this bi-directional selection could only works, if your bytecode contains source lines/local variables information. Check your compiler setings, if you is not sure that your compiler generates debug information.

If "Show raw bytecode" is off, than local variable names'll be shown instead of indexes, full qualified names replaced W ith simply class names, and primitive type abbreviations decoded to readable names.

If "Show current element Only" was on and then only bytecode of the current Field/method node would be shown (if the cursor is placed I Nside Field/method name or body).

2.1) Select *.class/*.java files, right click, Compare with, each of the other bytecode

2.2) Select one *.class/*.java file, right click, Compare with another class bytecode

To compare bytecode of selected class files. Compare works also for *.class files included in any referenced *.jar library.

"Toggle asmifier mode on/Off" button on both bytecode Outline and Compare View shows asmifier Java code, that generates SE Lected bytecode. More information on how to use asmifier you can find here.

Note:if asmifier mode is ' on ', then selection of Java code cannot being folowed by selection of appropriated bytecode Instru Ction, and Vice-versa; The "Show raw bytecode" action is also meaningless.

3) Java-bytecode reference, Windows---Show View---

To see reference documentation to selected bytecode instruction in the bytecode view. This documentation was taken from "Java Vsan" by Jon Meyer & Troy Downing Copyright (c) 1997 by O ' Reilly &am P Associates, and provided with permission of O ' Reilly Media, Inc. packaging, Cleanup, reformatting and XSL transformation C Ompleted by Eugene Kuleshov ([email protected]).

4) Help, Help contents, JVM instruction Reference

To see the entire bytecode reference documentation, provided with BCO plugin.
The final effect is as follows:

View Java bytecode Directive information under MyEclipse

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.