Monday, February 20, 2012

JAR to JAVA converter

I went through many websites,but i did not find any converter for jar file to .java files at one go.
So, I thought of writing a script for this conversion. This script also keeps the package structure same as in the jar file

Following are the prerequisites
  • This is restricted to windows platform
  • Unzip utility should be installed in the system
  • jad decompiler should be installed.
    If you don't have jad installed, you can find from the following link
    click here to download
  • Unzip the jad.zip downlaoded in step2,set the jad.exe in the systems path variable.
  • Run the command prompt in the administrator mode

Steps to run the batch file
  • cd "path to which batch file is placed"
  • jar2java.bat "jar file name/jar file path with jar file name"
  • Note: Give jar file name without extension
Download the batch file from here

Note:Remove the extention .txt to make it .bat file.

Example:
Step 1) >cd D:\jartojava (Copy the above downloaded batch file in this folder)
Step 2) jartojava> jar2java.bat abc (copy abc.jar in this folder)
Here a folder named abc is created with all the java files found in abc.jar.

1 comment:

  1. You can use this tool:
    http://www.neshkov.com/ac_decompiler.html
    AndroChef successfully decompiles obfuscated Java 6 and Java 7 .class and .jar files. It is simple but powerful tool that allows you to decompile Java and Dalvik bytecode (DEX, APK) into readable Java source.

    ReplyDelete