原文地址:Integrating JAD decompiler into JDeveloper

In JDeveloper, when debugging or otherwise navigating to classes that JDeveloper does not have the source code for, JDeveloper generates a "stub source", showing you only the fields and methods but not the source code. For many years, I have been using a neat "undocumented feature" of JDeveloper, which allows me to integrate the popular decompiler JAD into the IDE, so that I automatically get JAD decompiled code instead of those rather useless stub sources. Recently I wanted to use this feature on someone else’s computer, and, not having my laptop present, I tried Googling for this "undocumented feature", which lived up to its name insofar that I could not find it anywhere. So, before I have a harddisk crash and lose this knowledge for good, I’ll put it in this blog entry

First step is to dowload the free JAD decompiler, which you can find at this location: http://www.kpdus.com/jad.html#download. There is no installation process to speak of, it contains a single executable (jad.exe in case of Windows) which you can place anywhere on your harddisk. Then, you’ll need to go to open the file "<JDEV_HOME>\jdev\bin\jdev.conf", and add the red lines below to it:

##############################################################################
#
# Oracle JDeveloper 10g Launcher Configuration File
# Copyright - Oracle Corporation.
# All Rights Reserved.
#
##############################################################################
#
# The format of this file is:
#
# "Directive Value" (with one or more spaces and/or tab characters
# between the directive and the value) This file can be in either UNIX
# or DOS format for end of line terminators. Any path seperators must be
# UNIX style forward slashes '/', even on Windows.
#
# ADDED BY PEBELL
AddVMOption -Djcncmd=c:/progra~/decomp/jad.exe -& -p -b -ff -nl -pi99999 -space -t2 -noinner
SetBuiltRoot ../../built
AddJavaLibPath ../lib/patches
AddJavaLibFile ../../../classes

Of course, you need to use your own path to where you placed the jad.exe file. The "-p" parameter is mandatory (indicating that JAD needs to write its output (the decompiled source code) to STDOUT, which JDeveloper pipes to the editor window. The rest of the parameters guide the way in which JAD decompiles the code, and are a matter of personal preference. In this example, it indicates that it will use more braces than strictly necessary (for readability), fields will be put above the methods, String constants will break at newlines, imports will not be grouped, spaces will be placed between keywords (like "if") and expressions, indentation size = 2 spaces, and inner classes need not be decompiled. But there’s much more to choose from.

There is, however, one small caveat: when decompiling certain classes, JDeveloper seems to "lock up", in which case you have to kill the jdev.exe process manually and relaunch JDeveloper. Despite this instability (which might be cured with additional JAD parameters, SEE UPDATE BELOW)  I find this a very useful feature (or customization, or hack, whichever you prefer)! Check it out!

UPDATE

I seem to have found the cause of the instability problem. When using JAD from the command line on one of the "troublesome classes" that lock up JDeveloper, I noticed that some "debug messages" were written to STDERR:

Overlapped try statements detected. Not all exception handlers will be resolved in the method init
Couldn't fully decompile method init
Couldn't resolve all exception handlers in method init

Using the -& JAD option (which I just added to the jdev.conf line above), JAD redirects STDERR to STDOUT. The result when using JAD inside JDeveloper is that these messages are written to the decompiled code (where you get to see them), and that JDeveloper no longer locks up. Happy decompiling!

附:Jad下载地址

最新文章

  1. mysql函数大全
  2. JS表单前台校验模板
  3. POJ推荐50题
  4. SPSS数据分析—多维尺度分析
  5. hyper-v虚拟化管理
  6. C语言中的atan和atan2(转)
  7. YII Framework学习教程-YII的国际化
  8. lintcode 中等题:partition array 数组划分
  9. comm命令——
  10. Web Service学习文旦下载
  11. 一步一步制作yaffs/yaffs2根文件系统(七)---真挚地道歉以及纠正前边出现的错误!
  12. shiro开发,shiro的环境配置(基于spring+springMVC+redis)
  13. Oracle查看表实际占用空间和实际行数
  14. json格式字符串用Uncaught SyntaxError: Unexpected token &#39; Uncaught SyntaxError: Unexpected number
  15. RACSignal常见用法
  16. 利用RMAN转移裸设备到文件系统
  17. [转]微信小程序之购物车 —— 微信小程序实战商城系列(5)
  18. PHP MysqlI操作数据库
  19. 关于新塘 M0 M4添加库文件的说明
  20. 数据准备&lt;1&gt;:数据质量检查-理论篇

热门文章

  1. JAVA基础学习day15--集合二 TreeSet和泛型
  2. zobrist hashing
  3. 大写金额字符串生成 C#实现
  4. python中列表和元组以及字符串的操作
  5. javascript图片库
  6. CSS中的 backgroundPosition 属性
  7. Loj 1003&ndash;Drunk(拓扑排序)
  8. c++ initialize_list
  9. Linux Bash shell one practice : array if else
  10. 如何快速开发出一个高质量的APP——创业谈