aspose file tools*
The moose likes Beginning Java and the fly likes What is javap and how is it used? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is javap and how is it used?" Watch "What is javap and how is it used?" New topic
Author

What is javap and how is it used?

k Oyedeji
Ranch Hand

Joined: Jul 07, 2002
Posts: 96
Hi
Can anyone explain what this tool does, i tried to use it using a class in the local directory after reading the availble options but everything i tried returns a class not found error message

Thanks
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9046
    
  10
After you compile the class with javac, you can use javap -c to "decompile" the class. It will list the methods, etc.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1132

Hi "k",
I am assuming that "javap" is on your path (to confirm, just type the command:
javap -help
and you should get a "help" message)
Now I'm assuming that you have a class called "MyClass" that you want to use "javap" on. So, according to your description, there should be a file named "MyClass.class" in the current directory. If all the above is correct, then you should type this command (to achieve your desired result):
javap -classpath . MyClass
[Note: The above was tested on a Windows 98 computer with JDK 1.4.1]
Hope this helps you.
Good Luck,
Avi.
Divya Venkatesh
Greenhorn

Joined: Nov 05, 2002
Posts: 28
Well! Can someone please tell me what javap is all about.


Divya
David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
javap is a disassembler. If you use the -c option, it will print out a human readable version of the bytecode. There are also decompilers (such as JODE) which go one step further and create normal java source code from bytecode, but javap does not. To understand it, you'll have to do some reading of the Java VM Spec.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
And don't miss The javap Documentation.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is javap and how is it used?