How to decompile 3rd party jars from war file

This page lists down quick steps to decompile 3rd party jars from a war file. This could help us sometimes during troubleshooting an issue.

Download JD-GUI utility

-- Download the code
git clone
cd jd-cmd

-- Build from sources
maven install 

-- Unzip the dist package
mkdir install
cd install
unzip ../* .

Decompile the 3rd party Jars

Assuming you have already unzipped your war or EAR file, run the jd-cmd jar

java -jar jd-cli.jar /Users/sdalal/domainwar/WEB-INF/lib/*.jar

ls *src.jar | wc -l

Unzip all the source jars so that all sources can be stored in huge tree structure under same directory

find . -name '*src.jar' -exec sh -c 'unzip -o -d "`dirname \"{}\"`" "{}"' ';'

Feel free to play around with exec sh combination to store the unzipped sources in a separate directory

Use find command to find things of interest

find . -type f -name '*java'  -exec grep -l  java.protocol.handler.pkgs {} \;

Version History

Date Description
2016-12-25    Initial Version