Skip to content

Instantly share code, notes, and snippets.

@caputomarcos
Last active February 10, 2022 20:23
Show Gist options
  • Save caputomarcos/12c82f097419b1cdaa9a1ddd276b9e2f to your computer and use it in GitHub Desktop.
Save caputomarcos/12c82f097419b1cdaa9a1ddd276b9e2f 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)
wget http://www.benf.org/other/cfr/cfr_0_115.jar
  1. Run decompile with output into terminal
java -jar cfr_0_115.jar javaclasstodecompiles.class

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

java -jar cfr_0_115.jar javaclasstodecompiles.class > javaclasstodecompiles.java
  1. To decomplile a complete jar container
java -jar 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