Disassembling Java Classes - Java Tutorials

disassembling java classes



Disassembling Java Classes

To Disassemble a class file in Java there is a tool called javap. This Disassembling tool prints outs the details of the class like, methods, package, protected, public. When you wish to disassemble any class of java. first compile them using javac then call the javap Class Name.Consider the example given below


public class DisassesmleExample {
	public int add(int x, int y) {
		return x + y;

	public int substract(int x, int y) {
		return x - y;

	public int multiply(int x, int y) {
		return x * y;

Now Compile the aboove class using javac

C:\Java Test>javac DisassesmleExample.java

Now run it using javap as

C:\Java Test>javap DisassesmleExample
Compiled from "DisassesmleExample.java"
public class DisassesmleExample extends java.lang.Object{
public DisassesmleExample();
public int add(int, int);
public int substract(int, int);
public int multiply(int, int);

There are many available with this disassembler  tool they are. For example if you use javap -c DisassesmleExample. This will disassemble all the code, -l it will print line number and local variable. with -package It will show package/ public/protected classes and members. To see more option open your command prompt go to the java/bin directory and then type javap - help it will print all the option of javap.

Share on Google+Share on Google+

Disassembling Java Classes - Java Tutorials

Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: Disassembling Java Classes - Java Tutorials  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image