sandip chitale's blog    Sandip Chitale's blog (scblog)
NOTE: I have moved many of my modules to NetBeans Plugin Portal . Please check there for latest versions of modules described on this blog.
20061019 Thursday October 19, 2006

NBJAD (simple integration with Jad decompiler) module uploaded

I have uploaded the NBJAD Module to my Netbeans update center described here.

This module integrates the popular Jad Decompiler with the Netbeans IDE. This module provides the following action:

Action Key binding
Decompile Ctrl-F9

How to configure Jad

Download the Jad decompiler from here, install it and configure the location in the Tools:Options:Decompile panel (see screenshot below). Make sure you read and follow the Jad license.

How it works

When the View:Decompile action or the Decompile action in the pop up menu is invoked on the selected .class file node the Jad decompiler is invoked on it with the following options:
jad -o -r -s .java -d <user.home>/.nbjad [additional jad options] .class-file

where:
-o - overwrite the output files
-r - create folder structure consistent with package specified in the .class file
-s - suffix for output files i.e. .java. This trick makes the Netbeans Java editor simply work.
-d - output directory. This can be overridden with the System property
     "org.netbeans.modules.java.tools.nbjad.output.directory"

The output window shows the status of decompilation. Decompile action in the pop up menu is not available on the .class files inside a jar file. However View:Decompile action can still be used.

If the .class file is inside a jar file it is first copied to the disk under the System.getProperty("user.home") + File.separator + ".nbjad" folder. The copied file is marked for deletion on vm exit.

The decompiled .java file is output to a folder, consistent with the package specified in the .class, under the System.getProperty("user.home") + File.separator + ".nbjad". folder. The output .java file is opened in a Netbeans Java Editor tab.

The following additonal options can be specified:

TODO

  • Open decompiled files in read-only mode
  • Add action to clean up all decompiled files
  • Add decompilation output folder to the Favorites - DONE. This way you can easily get back to previously decompiled files.

Sources

DISCLAIMER: This module is experimental. So no guarantees. Use the module at your own risk.


Posted by sandipchitale ( Oct 19 2006, 10:42:59 PM PDT ) Permalink Comments [15]


Trackback URL: http://blogs.sun.com/scblog/entry/nbjad_simple_integration_with_jad
Comments:

too bad it works only with JDK 1.6 :-(

Posted by 192.18.43.249 on October 20, 2006 at 08:33 AM PDT #

NBJAD (Jad decompiler integration) module should work with any JDK that can run Netbeans 5.5 or 6.0. For example I am running NetBeans 5.5 RC2 (Build 200610120000) with jdk1.5.0_06.

You may be confusing NBJAD with similarly named NBJHAT (running OQL queries on heap dump files generated by jmap). If not, please let me know what is not working for you with NBJAD module. It is true that NBJHAT works with JDK1.6 only.

Posted by Sandip on October 20, 2006 at 09:00 AM PDT #

Too bad you didn't join this project :-(

https://nb-jode-jad-module.dev.java.net/

Posted by Ramón on October 20, 2006 at 09:43 AM PDT #

I was not aware of it.

BTW the link should be:

https://nb-jode-jad-module.dev.java.net/

Posted by Sandip on October 20, 2006 at 10:03 AM PDT #

I tried to install the plugin on a mac nb5.5 jdk 1.5 and could not. If I remember the error message, it was related to dependency on 1.6

Posted by 192.18.43.249 on October 20, 2006 at 10:46 AM PDT #

NBJAD is not dependent on JDK 6. Are you sure you were trying to install NBJAD?

NBJHAT, a different module on my update center is dependent on JDK6.

Posted by Sandip on October 20, 2006 at 11:18 AM PDT #

For 10 tests, it work 1 time, odd

Posted by goldy on November 21, 2006 at 08:25 AM PST #

Goldy, do you see any exceptions in the console? in the <user-dir>/message.log? Are you .class files on the disk, in a jar or zip file?

Posted by Sandip on November 21, 2006 at 08:50 AM PST #

Well I see no exception in the console ... and It work now! Thanks for response

Posted by goldy on November 22, 2006 at 01:24 AM PST #

Thanks Sandip, works great for me on NB 6.0 Dev build running jdk6.0. Couple of requests: Would like to be able to decompile an entire jar (and for the jar name to be the root of the decompiled classes so that it is separated out) and would like to be able to set the decompile root directory.

Posted by Dan on January 11, 2007 at 04:49 PM PST #

Oh...and ctrl-F9 is the shortcut for evaluate expression in the Run menu...

Posted by Dan on January 11, 2007 at 06:35 PM PST #

Thanks Dan.

Your idea about the jar file sounds interesting. I will look into it.

Actually you can change the output directory settings by setting the System property:

org.netbeans.modules.java.tools.nbjad.output.directory
in the netbeans.conf file.

About Ctrl+F9 - I chose it to shadow F9 for Compile File. I did not realize that it conflicts with evaluate expression. You can always change the settings in Tools:Options:KeyMap:Other category.

Posted by Sandip on January 11, 2007 at 06:52 PM PST #

Great work you're doing, Sandip.
Works great in my NetBeans IDE.

Posted by Marvin on September 23, 2007 at 10:47 AM PDT #

Thanks for this module! Works great for me, too.
I use NB5.5.1 and jdk1.6.0

BTW:
I restarted the IDE to see the decompiler menu in options dialog...

Posted by Peter Karich on October 09, 2007 at 12:20 AM PDT #

Thanks Peter. About requiring the IDE restart to see the decompiler menu - I have seen that happen sometimes. I will look into it.

BTW if you downloaded the module from my blog's update centre, a
later version may be available here:

http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=117
7

Posted by Sandip on October 09, 2007 at 05:57 AM PDT #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed








« July 2009
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
       
Today

Get NetBeans 5.5

Locations of visitors to this page

Today's Page Hits: 295


XML
All
/Creator
/General
/Hobby
/Java
/JavaScript
/Mozilla
/NetBeans
/Ubuntu
/VisualWeb
/VisualWebPack
/Web 2.0

XML
All
/Creator
/General
/Hobby
/Java
/JavaScript
/Mozilla
/NetBeans
/Ubuntu
/VisualWeb
/VisualWebPack
/Web 2.0

scblog
scblog