I have seen my friend retrieving the source-code file from a java '*.class' file.He used some kind of a software for it.

Is it possible to do the same with an '*.exe'? If yes,how can I do it? Also is it ethical to do such a thing,considering the executable is just a small file which is not copy-righted?

  • 2
    As to the last question, in the past there's been a lot of litigation surrounding this issue, but mostly in circumstances where an executable was reverse engineered with sole purpose of producing a competing product. If your interest is purely academic, there's usually no recourse for the developer. – Blomkvist May 12 '11 at 13:50
  • Where did you get the idea that executables are not subject to copyright? Or did you just mean that you're concerned with one specific executable which happens to have been placed into the public domain? – Dave Sherohman May 12 '11 at 14:11
  • Yea I meant that the one I have with me is not copy-righted – Pavitar May 12 '11 at 14:13

It depends on the underlying language that the developers used.

For Java and .NET languages it is possible most of the time to "de-compile" the source code. it's not going to be the true original code (variable names will be different, optimizations by the compiler will have rearranged code, etc) but it will be close.

Other languages such as C/C++ are not so easy.

As far as the ethics go, if you are just a hobby coder interested in playing around then that's fine. However, if you are a professional and you're trying to get source code to copy an app then that's very unethical and a big no-no!


If the application is written in one of the .NET languages (VB/C#), you can use Red Gate's Reflector reflector.red-gate.com to disassemble the application into corresponding source files. Not every application is written in managed languages like this though, and decompiling a C++ application, or one written in Delphi or another non-managed language is not nearly as easy, and all you can really get are hex dumps, which are very difficult to then reconstruct into an actual application.


You can't do it if your .exe code is in C/C++, but if it is in C# you can do it. I don't know a good tool for that, but one way is using ANTS Profiler. It shows you all objects, methods and arguments from a C# binary.


Yes it is possible to decompile .exes using tools like The dcc Decompiler. This will produce good results if the original program was written in C. If it was written in another language then you may have to try another tool that is suitable for that language.

When decompiling software, the more Assembly language you know, the better as you may have to examine the high level code from the low level assembly if the decompiler becomes confused or if some of the code was actually written in Assembly language.

Decompiling is an excellent way of studying how programs work at the lowest level. You will also find that in many cases the decompiled program will compile back into the exe but the symbols used to describe the variables are totally meaningless. You may have to do detective work to actually understand what the code means and does.

I don't see anything wrong ethically for decompiling the code for your own amusement or education but if you have malicious intent such as decompiling commercial software to change the copyright message to your own or to seek out a vulnerability for malicious exploitation then this could be considered unethical.

You may find that the developer has gone to some lengths to prevent decompilation by creating a loader that unpacks the software into memory or has code explicitly to confuse decompilers. This is all part of the fun.


The technical side: Yes, it is possible to decompile the code... sort of. What you'll get back will not be the original source code and it may not even resemble the original source code all that closely unless the executable was compiled with full debugging symbols enabled. Final production builds often have debugging symbols disabled, however, in order to keep the executable as small as possible and to avoid giving any more than the bare minimum of information to anyone who examines the executable.

The legal side: Under the Digital Millennium Copyright Act, attempting to decompile or reverse-engineer any software which the copyright holder has attempted to protect against this. As interpreted by courts thus far, it doesn't matter how ridiculously feeble the attempt might be, it's still illegal. Even if there are no technological measures in place to protect the code, there is likely to be a license agreement stating that you are not allowed to decompile or reverse-engineer the executable.

As a general rule, I tend to consider these things to be entirely ethical, so long as you're not doing them with the intention of harming anyone else, but the law tends to disagree.


Getting source code from .class files java is easy but it is difficult to get code from .exe files.Use this http://www.hiew.ru/ to disassemble .exe files but this generated code will not be same as original as it misses many lines that are ignored by the compiler which makes it hard to read.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.