Search code examples
javajarrunnable-jar

How can I get my source code back after I exported on .JAR file and after that I erased the project from the Workspace?


I exported a project from Eclipse and then I tried to run'it in my machine and I couldn't. I readed some articles and I realized that I exported the program on a wrong way, (I'm using Eclipse as mi IDE) Eclipse gives you the option to export the project whit the (Runnable.JAR) option and the (.JAR extension), both are different. I thought the right way It was .JAR extension, but It wasn't, I tried with another project the (Runnable.JAR) and It worked. but I erased my priory project from the workspace of Eclipse(the one the I imported with the .JAR extension),and I've tried to import the program with the .JAR extension and it works but it just appear the compiled file, I can't run it. How can I convert the (.JAR to Runnable.JAR) or at least use it?


Solution

  • From what I can tell the only options you have are to either attempt to recover the deleted workspace, decompile your code, or restart the project.

    To decompile your code I suggest either using this, or this, both should do what you want, but I've always had good luck with the 2nd option. As long as you haven't obfuscated your code, this should work correctly.