Java: Recursive Decompiler

In order to decompile huge amount of java code, which is in directories and sub-directories etc, you can use the following technique:

Create 2 directories in the same path in your windows machine:

\src
\classes

in the same directory, create the batch file decompiler.bat which will have the following code:

@echo off
echo Copying .class files...
xcopy /Q /E /Y classes src

echo Decompiling .class files into .java files...
for /R src %%a in (*.class) do jad -d %%~dpa -o -s .java "%%a"

echo Deleting .class files...
cd src
del /S /Q *.class
cd..
pause

at the same directory you must put also the jad decompiler, which you can download here:

Now put your classes in the “classes” directory, with their original directory structure.

Fire the decompiler.bat.

Your .java source files will appear in the “src” directory, with their original directory structure, right after the execution of the script.

Leave a Reply