Source code missing for many reasons: failure of backup files, you can not back up files, accidentally deleted, the hard disk to run the error and so on.Although the majority of programmers in their careers will encounter this situation, but we have good news: For the average Java class files, the re-generate the source code is not difficult.
Class files generated from source code to re-process is called decompilation.There are many procedures can decompile Java class files.But the most popular is Java Decompiler (JAD).JAD is a command line tool, you can decompile a class or group of classes, but also for most operating systems are available.
When you use the JAD decompile class, you will get the class each be decompiled source code.Once you have source code, you can modify, recompile, or backup source code without having to use a decompiler.
Here is an example of using the JAD command line:
jadEmployee.class
Parsing Employee.class ... Generating Employee.jad
The shortcomings of JAD
Decompile Java class files are relatively easy; Therefore, there is now so anti-compiled class files are not tools of the market.
These provide protection tool called Fanfan build tools (obfuscator).If you want to decompile the class files compiled by Fanfan, that JAD or other similar program can not generate source code for such a class file.
Anti-compiler does not retrieve the original code in exactly the same; it is only the code generated is equivalent to the original source.Anti-compiled class files are not the original source code comments, so you lose the source code is lost all the comments.
If you have the appropriate backup measures, you do not need to recover a lost source; but if you want to do this job, you will find useful JAD.