I deleted a Java project from my hard disk in an attempt to do some refactoring with Eclipse. Luckily I found a recent version of an Executable Jar File and decrompressed it into a bunch of .class files. I've read some 'decompiling' threads on SO and tried showmycode.com, but I was hoping for more. Isn't it possible to convert .class files into the .java files that made them, comments included - nothing changed? Or find the in the .jar file? What are my best options if not? Other answers on the topic seem outdated. Do I need to download software?
Asked
Active
Viewed 1,620 times
0

ROMANIA_engineer
- 54,432
- 29
- 203
- 199

user2651804
- 1,464
- 4
- 22
- 45
-
2Check your trash. :) Reverse engineering is not perfect. – ROMANIA_engineer Sep 27 '14 at 15:22
-
1No. You can’t restore information that does not exist. Therefore, no tool will restore comments, your choices about equivalent code constructs nor formatting. And unless you have compiled with debugging information, names of local variables are lost as well. – Holger Sep 27 '14 at 15:22
-
1If you still have the Eclipse project but not the source in the project you could try Right clicking on the project and selecting 'Restore from local history' to see if Eclipse has any backups. – greg-449 Sep 27 '14 at 15:24
-
1That's the perfect moment for you to learn using git. – JB Nizet Sep 27 '14 at 15:26
1 Answers
3
You will not be able to get your comments back, they are lost when you go from .java to .class. As to how to do it any "Java Decompiler" can do it, your code will not be exactly what you wrote, however the code you get back will be functionally the same as what you originally wrote.
JD is a decompiler I have used before and have been happy with its output.

Scott Chamberlain
- 124,994
- 33
- 282
- 431
-
Beat me to it :P. I've had some luck with it two years ago when I was curious about another project without available source code – Alex Sep 27 '14 at 15:25