Search code examples
javareverse-engineeringwardecompiling.class-file

Conversion of class file to Java files


I have one War files (a Java application) consist of 64 class file along with image/CSS/JS files. I have lost the source of this war file. Now I want to do some changes in code. I am looking for some expert advice from community on following questions.

  1. Is there best way to convert .class files to .java file without losing any section of code?
  2. What are the tools if any for this task?
  3. What are challenges/drawbacks of converting .class files to .java files to recreate war file?

Solution

  • If you do not want to spend horrible times in understanding decompiled bytecode, please start using a version control system and a remote repository for any project of more than two classes.

    In particular, you can use Git with GitHub, open source are hosted for free while if you want to protect your code you can get a commercial subscription which is cheap anyway.

    For this time, help yourself with a java decompiler such as JD:

    1. Use a java decompiler to decompile the bytecode.
    2. Create a git repository out of the decompiled java classes
    3. Constantly synchronize it with the remote repository