mc.ext: allow Java class files to be viewed even if JAD isn't on PATH

Closes MidnightCommander/mc#134:

  * `file -b` prints class file version, which `javap` doesn't by default
  * `javap`'s stderr should be suppressed as it may print `_JAVA_OPTIONS`
     if this variable is set

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
This commit is contained in:
Andrey Shcheglov 2018-05-19 00:10:13 +03:00 committed by Yury V. Zaytsev
parent 2eb7ef9e04
commit f161d19038

View File

@ -48,7 +48,8 @@ do_view_action() {
ctorrent -x "${MC_EXT_FILENAME}" 2>/dev/null
;;
javaclass)
jad -p "${MC_EXT_FILENAME}" 2>/dev/null
jad -p "${MC_EXT_FILENAME}" 2>/dev/null || \
(file -b "${MC_EXT_FILENAME}"; javap -private "${MC_EXT_FILENAME}" 2>/dev/null)
;;
*)
;;