This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Read Byte Code

 
Gautam Sathe
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we read byte code (i.e. the contents of .class file)? If so what is the command?
------------------
 
Ender Everett
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're in Windows, you could go to the MS-DOS prompt and open up any *.class file in the text editor. Enter the editor by typing
c:\whatever\>edit
Most people don't use the DOS editor these days... I'm an old fashioned Command-Line Commando...
-Ender
PS: I hope that's what you meant. You can also enter
c:\>more <*filename*.class
and it will output the contents to the screen. The only problem with this is that the machine codes affect the output of "more <*.*" very heavily, so you won't see the true contents...and sometimes you get old-school DOS beeping noises, which are annoying.
[This message has been edited by Ender Everett (edited June 01, 2001).]
 
manish paliwal
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear,
u should read first Input/Output Stream ( java.io.*)
ok byee
------------------
manish paliwal(or just mann )
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think what he is asking for is a decompiler. If you do a search on decompiler (in google or yahoo or wherever) you will find lot's of free ones to play with.
However if the code has been obfuscated then it becomes exceedingly harder.
 
Ender Everett
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AH! yeah, I thought he was wanting to look at the actual byte code itself.
If you want a good decompiler, check out DJ Java Decompiler ver 2.???. It's on Download.com last time I checked, and it does a pretty good job. Your OS must be Windows, I think, to use it.
Which brings up an odd question: Are there any Java decompilers written in Java?
 
Gautam Sathe
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of my friend told me that there is some java*.exe in command to read the byte code? I am not looking for decompiler like DJ Decompiler.
------------------
 
Ender Everett
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, You've got me confused now... what exactly do you mean when you say "read byte code"?
If you mean open it up and take a look at what actual characters are in your byte code file, the way I listed in my first post is one among many methods. (there's absolutely nothing to see in bytecode, however... it is even less useful than machine language, as it is interpreted, not the machine-form of assemlby)
If you mean decompile (which you just said you didn't), then the decompilers are the way...
You've got me really confused now... what do you mean? And what is it that you are trying to do in the end? Perhaps there is a better way of phrasing the question.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a javap.exe program that will read the byte code and give you a summary of the fields and methods signatures, but it does not show the code that is going on IN those methods. Is that what you are looking for? I believe that the class has to be available outside a jar file for it to work.
>javap MyClass

[This message has been edited by Cindy Glass (edited June 02, 2001).]
 
Gautam Sathe
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Cindy I was looking for this command.
Gautam.

------------------
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic