3

So I have an Eclipse project I have been working on for quite sometime now and my program that backs up the project hasnt been doing it for months, and I never bothered to check the back ups (stupid me). Well the project got corrupt and I lost all the files and dont have a back up that is even close to up to date. However I do have the jar file that is fairly recent (it only contains .class files) and I was curious if anyone knew how to convert a jar file with .class files into an eclipse project. Thanks for the help!

Tyler
  • 88
  • 1
  • 7
  • I don't know if you can do it in Eclipse, but IntelliJ has a fairly powerful decompiler. You won't get exactly your original source code, variable names, or comments, but you will get something you can work with. – Brandon Dyer Nov 26 '19 at 19:51
  • I don't know how to do it in Eclipse, but I recommend you to use Git or SVN from now on, so your code is always safe so this doesn't happen again – Frakcool Nov 26 '19 at 20:00
  • Possible duplicate of [restore project from jar file](https://stackoverflow.com/questions/10296330/restore-project-from-jar-file) [Extract source code from .jar file](https://stackoverflow.com/questions/5107187/extract-source-code-from-jar-file) – Petr Aleksandrov Nov 26 '19 at 20:02

1 Answers1

2

You can follow the steps given below:

  1. Make sure you have a working decompiler in eclipse. If not, please install https://marketplace.eclipse.org/content/enhanced-class-decompiler into your eclipse.
  2. Create a new Java project in eclipse > Right-click the src folder > Click import > Select Archive from the list to import your JAR
  3. Expand the JAR in eclipse and double click a class file to decompile it.

    enter image description here

Arvind Kumar Avinash
  • 71,965
  • 6
  • 74
  • 110