-2

As a project at some point in time, I would like to make my own Java decompiler to convert bytecodes back to plain text.

I did Google for some APIs that would let me do that but I could not find any.

So my question to you is: How do I decompile the class file ?
If there is an API and I have missed that, please let me know.

I know that book questions are frowned upon but do you think Decompiling Java Language by Godfrey Nolan is a good place to begin at?

An SO User
  • 24,612
  • 35
  • 133
  • 221

1 Answers1

7

So my question to you is: How do I decompile the class file ?

  • By writing lots and lots of Java code to implement a decompiler ... or
  • By starting from an existing open source decompiler and modifying it. (But you will need to understand and conform to the license ...)

These steps need to be preceded by background research / reading to understand the domain, formulating requirements, design, etcetera. That's way beyond the scope of a SO Question.

If there is an API and I have missed that, please let me know.

AFAIK, there isn't one.

But you should be able to find source code in other forms. (How reusable it would be is anyone's guess. But, hey, this is your project.)

(Frown!)

I've not read that book, but it is probably worth a read, especially if the only alternative for learning is reversing engineering an existing codebase. Try going to your favourite online bookstore, reading the reviews, the ToC, etcetera ... and make up your own mind whether it is worth buying.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • The reason I asked was because the book was published in 2004 – An SO User Apr 12 '13 at 05:31
  • It is still relevant. It might not represent the state of the art, and it might not cover stuff in more recent versions of Java, but what it does cover should be valid. By the way the same author has a newer book on decompiling Android ... – Stephen C Apr 12 '13 at 06:58
  • So, decompiling Android will be the same as decompiling Java ? – An SO User Apr 12 '13 at 13:59
  • 1
    No. The instruction sets, etcetera are different, obviously. But the basic problem is the same, and (presumably) there are similarities in how you would do it. – Stephen C Apr 13 '13 at 00:13