README.org

February 13, 2017 ยท View on GitHub

[[https://melpa.org/#/jdecomp][file:https://melpa.org/packages/jdecomp-badge.svg]] [[http://www.gnu.org/licenses/gpl-3.0.txt][file:https://img.shields.io/badge/license-GPLv3-blue.svg]]

  • JDecomp

** Introduction

=jdecomp= provides an interface to various Java decompilers. The current supported decompilers are:

** Installation

Install via [[https://melpa.org/#/][MELPA]].

For general information on installing Emacs packages, see the [[https://www.emacswiki.org/emacs/InstallingPackages][Emacs Wiki]].

** Setup

In your init file, add the following to activate =jdecomp-mode=:

#+BEGIN_SRC emacs-lisp (jdecomp-mode 1) #+END_SRC

Set customizable variable jdecomp-decompiler-type to a known decompiler type:

  • cfr (default)
  • fernflower
  • procyon

E.g.

#+BEGIN_SRC emacs-lisp (customize-set-variable 'jdecomp-decompiler-type 'fernflower) #+END_SRC

Set customizable variable jdecomp-decompiler-paths to decompiler paths. E.g.

#+BEGIN_SRC emacs-lisp (customize-set-variable 'jdecomp-decompiler-paths '((cfr . "/Downloads/cfr_0_118.jar") (fernflower . "/idea-IC-162.1628.40/plugins/java-decompiler/lib/java-decompiler.jar") (procyon . "~/procyon-decompiler-0.5.30.jar"))) #+END_SRC

Use =M-x jdecomp-mode= to turn the minor mode off, or call

#+BEGIN_SRC emacs-lisp (jdecomp-mode -1) #+END_SRC

** Features

*** Decompile classfiles

When =jdecomp-mode= is active, opening a [[https://en.wikipedia.org/wiki/Java_class_file][Java classfile]] (including those in JARs) automatically decompiles the file and displays the result in a preview buffer.

** Options

Set customizable variable jdecomp-decompiler-options to options for decompilers. E.g.

#+BEGIN_SRC emacs-lisp (customize-set-variable 'jdecomp-decompiler-options '((cfr "--comments false" "--removeboilerplate false") (fernflower "-hes=0" "-hdc=0"))) #+END_SRC

** Future work

Support more decompilers:

Maybe [[others]]?

** Other

This package is inspired by [[https://github.com/gbalats/autodisass-java-bytecode][autodisass-java-bytecode]].