(defvar jdc-command "jad"
"The name of the decompiler if it's on your path, otherwise
a full qualified path to it.")
(defvar jdc-parameter " -space -t2 "
"Extra parameter which should be added to the call of the decompiler.")
(defvar jdc-extension "jad"
"The extension which is used for the generated java files.")
(defun jdc-find-file ()
"Find a classfile and decompile it, opening the decompiled file instead."
(let ((jdc-classfile (read-file-name ".class file: ")))
(defun jdc-buffer ()
"Construct the command for decompiling a class file, call the resulting
command and load the decompiled file."
(jdc-classfile (file-name-nondirectory (buffer-file-name)))
(jdc-javafile (concat (substring jdc-classfile 0 -5) jdc-extension))
(command (concat jdc-command jdc-parameter jdc-classfile)))
(let ((file (buffer-file-name)))
(cond ((string= (substring file -6) ".class")
(progn (jdc-buffer) (jde-mode)))))))