Skip to content

Instantly share code, notes, and snippets.

@DanNYSPD
Last active November 13, 2020 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanNYSPD/2670fd1b72ce135ec616190663ae69b4 to your computer and use it in GitHub Desktop.
Save DanNYSPD/2670fd1b72ce135ec616190663ae69b4 to your computer and use it in GitHub Desktop.
Decompile Java class or Jar container under Linux Mint / Ubuntu

Lee Benfield's Java decompiler CFR is straight forward and can even batch decompile jar container. 

  1. Download the most recent version of CFR (crf 0.1.15 at the time of writing)
cd /usr/local/bin && wget http://www.benf.org/other/cfr/cfr_0_115.jar
  1. Run decompile with output into terminal
java -jar /usr/local/bin/cfr_0_115.jar javaclasstodecompiles.class

2a. Run this if you want to export it into a separate Java file

java -jar /usr/local/bin/cfr_0_115.jar javaclasstodecompiles.class > javaclasstodecompiles.java
  1. To decomplile a complete jar container
java -jar /usr/local/bin/cfr_0_115.jar javacontainer.jar --outputdir ./javacontainer

Caveat: When using "--ouputdir" the directory path is not relative to the folder CFR runs in. So make sure you either use an absolute path or the "." for relative paths.

Alternativie decompiler:  javadecompilers.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment