Using the following external tool configuration we can view java byte code in eclipse with the help of javap
:
To get the above pop-up select Run
option and select External Tools
and select External Tools configuration...

${system_path:javap}
is used to locate javap in the JDK used by the Eclipse. You can use an absolute path to javap instead.
${project_loc}
returns the absolute path to the project. This is used, since I could not find a pre-define variable to use, to locate the .class
file of a resource, and that's why javap
runs in the project's directory instead of the directory containing the .class
file.
Among the arguments passed to javap
:
bin
is the default output folder for Eclipse projects. Change this to build/classes
or whatever is used by the project. Note, the value is relative to ${project_loc}
; you can specify absolute paths instead.
${java_type_name}
is used to obtain the selected class name.
You can select a Java file in the Project explorer view or Project navigator view, or even a Java type in any of the views, and then run the external tool. Note - this approach doesn't work quite well when you select a method, an inner class etc. and then run the tool, as they are not resources on their own, leading to the scenario where ${project_loc}
will be empty.
Source
Dr. Garbage Tools is a suite of Eclipse Plugins released under Apache Open Source license.
Install Bytecode Visualizer using Eclipse Marketplace.
To view a bytecode:
Right click on .java
file, select open with
and select other
you will get the following popup:

Search "Bytecode Visualizer" and select the option it opens the file as follows there you can find Bytecode option as shown:

Enhanced Class Decompiler
"Window > Preferences > General > Editors > File Associations"
Change default to your for both .class association.
"*.class" : "Class Decompiler Viewer" is selected by default.
"*.class without source" : "Class Decompiler Viewer" is selected by default.
