Revert Java source from .war file?

I recently lost my project netbeans project folder that I was working on at that time. However, somewhere on the server here in the company I'm working on, I deployed it. So this means that I (hopefully) can still get the .war file.

Is it possible to “unzip” this .war and return my source .java files that I was working on at that time?

Thanks in advance!

+4
source share
5 answers

If the .java sources are not in the WAR (and should not be), you will need to take an extra step to decompile them using the JAD tool.

It's a good time to install a version control system such as Subversion or Git or Mercurial, so this will never happen to you again. Get in the habit of using source control, even if you are the only developer working on a project.

+9
source

You only get * .class files from your war (rename the war to zip and use the decompression tool).

Then you can decompile them.

See this related question for some suggestions .

+2
source

Short answer: None.

A slightly longer answer: find Java decompilers , but they will not give you the Netbeans project folder.

+2
source

Suppose if you exported the source files when creating the war, you can get it. Else, JAD is your only hope, which also cannot fully rely on it.

0
source

You can unzip the war file, in which you get only class files and other property files. Then use the Java decompiler to see the source code, and it works very well (not recommended).

You can also change the properties files without JD, and all you need to do is just change the properties files and fasten the war.It file again.

But I would recommend that you maintain the source code in SVN or TFS or multiple copies with version numbers on the local system at any given time.

0
source

All Articles