Basically I'm starting to play around with java and I learned about how source code is compiled into object code when it's compiled. So I began to wonder if source code can be compiled into object code can object code be translated into source code? If not, why not?
Answer by javawag · Sep 08, 2010 at 01:37 PM
Yup, this is called decompiling - it can be performed on MSIL (Microsoft Intermediate Language, the language C#, VB.Net etc compile into). In theory it should be quite easy to "decompile" java "bytecode" (the object code) back into source code, however it's a practice that is often frowned upon. Also, the source code will not necessarily be 100% the code you entered - it may have been optimised and things may have been renamed - e.g.:
int myCounter = 0; PersonClass person = new PersonClass("Steve");
could end up as something like:
int __a = 0; __classA __b = new __classA("Steve");
Hope this sort of helps!
Answer by trueb · Sep 08, 2010 at 09:17 PM
yes it can: but because when you write code in a high level language there are many ways the compiler can translate it to assembly. when you go though a disassembler or de-compiler (IDA is popular) it can also take that code and translate it to many ways in your high level language.
what im getting at is that when you go from high level to low level and back to high level, the code does not like anything like the code you started with, and because comments are not compiled to the object, it is very hard to reverse engineer.
point being yes it can be done, but not everyone can do it, and understand it.
there are supposedly tricks to do to make it harder to do this, but they often times make the code inefficient.
website or software source? 1 Answer
Where can I get the Linux source code? 2 Answers