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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
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: 18709
    
  40


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: 10247
    
    8



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.


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

Joined: Oct 02, 2003
Posts: 11229
    
  16

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?


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

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 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38340
    
  23
Try the javap tool.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to open a .class file ? can not open with text editors!