Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I read a Java class file (Java bytecode) [closed]

Tags:

java

How do I view the contents of a .class file (java byte code)?

How do I open these type of files in Linux? I'm using Centos 5.8.

like image 290
karunakar Avatar asked Jan 03 '13 20:01

karunakar


People also ask

How do I read a .class file bytecode?

Using javap. The Java command-line comes with the javap tool that displays information about the fields, constructors, and methods of a class file. Based on the options used, it can disassemble a class and show the instructions that comprise the Java bytecode.

How do I open a byte code?

The JDK comes with javap which is a tool to disassemble the byte code inside a class file. Editing on byte code level is possible. Have a look at BCEL, a java library designed to read, manipulate and write class files.

How do I decode a Java class file?

class without source default to Class Decompiler Viewer . Now, click on the class or methods, press F3 , and the plugin will automatically decompile the Java class.


2 Answers

javap -c X will show the disassembly of X.class.

like image 112
NPE Avatar answered Oct 16 '22 22:10

NPE


Read bytecode

javap -v com.company.package.MainClass

To understand bytecode You can use this list of mnemonics

like image 13
Marcin Szymczak Avatar answered Oct 17 '22 00:10

Marcin Szymczak