aspose file tools
The moose likes Beginning Java and the fly likes how to open a .class file ? can not open with text editors! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "how to open a .class file ? can not open with text editors!" Watch "how to open a .class file ? can not open with text editors!" New topic
Author

how to open a .class file ? can not open with text editors!

sahar sa
Ranch Hand

Joined: Jul 06, 2009
Posts: 102
Dear friends,
I have some".class" files but I cannot open them with text editors like notepad and word and not even by netbeans. How can I open it?
the file contains some java classes.

thanks,
Sahar.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16680
    
  19


Class files are binary files. They are not text files, and hence, can't be opened by a text editor.

To view the file, you'll need some sort of editor just for binary files. Or maybe even a decompiler.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
sahar sa
Ranch Hand

Joined: Jul 06, 2009
Posts: 102
Dear,
Thanks for your complete answer. now I can open the file using Dj Java Decompiler.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8430



Well I could "open" mine in notepad. It's a different story that it makes no sense, because, like Henry said, it is a binary file.


[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 9939
    
    6

I would ask you, why do you WANT to open a .class file? Would you open a .exe file?

There are ways to open/look at one, but that's probably not what you REALLY want to do. Is it?


Never ascribe to malice that which can be adequately explained by stupidity.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19214

fred rosenberger wrote:Would you open a .exe file?

Yes. Even if I wouldn't use a resource investigating tool to retrieve bitmaps, icons etc from the exe, I would still open it with rundll32.exe. You might call that "run" the .exe file


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32595
    
    4
Try the javap tool.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: how to open a .class file ? can not open with text editors!
 
Similar Threads
Search tool to search all class files
Can I write in MS Word File from FileOutputStream Constructor
Problems with newlines in text files
What is mean by corrupting of a file?
Logging