Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reverse engineering a war files in eclipse

 
Thennam Pandian
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Friends,

i need to create java file from a war file .


can i use Eclipse ,studio Creator or Netbeans .......
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A war file is a web application, not a Java class. It contains many resources like HTML, JSP, CSS, JS, libraries, configuration data and properties as well as Java classes.

Technically a war file is a ZIP file, so it should be easy to get at its contents using any old unzip program.
 
Bharat Roy
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you want the source code or just the compiled classes? If the case is later than:

(1) Rename the war archive to jar.
(2) jar -xvf warFileName.jar

This will unpack the entire structure.

If you want the original source code then you should have some utility like Java Decompiler. But even then you will have to unpack it. The code will be cryptic though, due to optimizations that the compiler does.

Make sure you are not doing this "reverse engineering" on the copyrighted material.

HTH
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ankur Bhatt:
(1) Rename the war archive to jar.
(2) jar -xvf warFileName.jar

Note that the jar command (or your favorite unzipping program) can unzip war files too. So you could just do:
java -xvf wareFileName.war
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic