TC JAD Java Decompiler Plugin - See class files as java code

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

User avatar
yyang
Member
Member
Posts: 155
Joined: 2007-03-27, 11:41 UTC
Location: China

Post by *yyang »

esandrei wrote: Is there a specific reason why you would like to change the font or you just prefer another font/font size?
Sorry for my late response... Courier New is my favorite too, but on my laptop the decompiled code is obviously not display in Courier New:

Image: http://i50.tinypic.com/fwmxwx.png

That's why I thought a configuration option might help.

My environment is Windows XP Pro with SP3 Simplified Chinese Edition. The font in the linked image is SimSun, the system default for simplified Chinese text on Windows prior to Vista, I think.

Update: It seems that adding these lines to initDefaultStyle() in highlight.cpp fixes my problem :D:

Code: Select all

default_style.dwMask |= CFM_CHARSET;
default_style.bCharSet = DEFAULT_CHARSET;
User avatar
yyang
Member
Member
Posts: 155
Joined: 2007-03-27, 11:41 UTC
Location: China

Post by *yyang »

XPEHOPE3KA wrote:2esandrei
Bugs:
- doesn't support spaces in filenames (opens e:\Cache.class, but if I rename it to e:\C ache.class, just binary lister view is shown)
- doesn't support Russian characters in path (d:\Development\Java\Диплом\bin\org\spbu\bdd\core\Cache.class wouldn't open)

Reproducable 99% of the time.
The first issue is due to a reasonable assumption in the source code that file Foo.class corresponds to class Foo. If the .class file is renamed to Bar.class, the plugin will fail to locate the generated file Foo.java in the plugin's installation directory. (You can find it there anyway; since a Java class cannot contain any space, you must have renamed the .class file, have you?) This could be fixed by reading from JAD's output (stderr) for the path of the generated .java file.

The second issue is caused by the decompiler JAD itself. It just can't handle "unusual" characters like CJK and Russian in the path. This could be fixed by setting the JAD process' current directory to the .class file's directory.

I'll try to make a patch or something if my time allows.

Update: I've made a mod version and uploaded it here: http://www.4shared.com/zip/HmiBqkZn/tc_jad_plugin_sources_101_mod_.html. The problems found by XPEHOPE3KA and me have been fixed (hopefully). To have a try please replace your old tc_jad_plugin.wlx with my version.

As I'm more familiar with Visual C++, I just put all necessary source files into one folder and compile. All modifications are marked out in the comment (search for "yyang"). The modified files are decompile.cpp (major patch work), highlight.cpp (1 mod), and listplug.cpp (2 cosmetic mods for VC 2008 and VC 2010 to compile). The included tc_jad_plugin.wlx is compiled with VC6. You can use build.bat to compile your own version (provided cl.exe is on your PATH; remove "/opt:nowin98" if you use VC 2010).

If the .class file itself contains, say, CJK characters, my version won't work. It's a limitation of the JAD decompiler. Copying it to a regular-name tmp file and decompiling that file feels weird to me. Please do it manually.

@esandrei: Please feel free to incorporate my code into your future version. Thanks.
esandrei
Junior Member
Junior Member
Posts: 8
Joined: 2012-04-09, 04:21 UTC

TC Jad Plugin 1.1

Post by *esandrei »

Thanks you XPEHOPE3KA and yyang for finding bugs and fixes and taking your time to post them here.

@yyang you got them all right :)

TC Jad Plugin 1.1 includes your fix for the font(could't test it on a Chinese system though) and is also fixing XPEHOPE3KA's bugs.

I actually opted for your last thought to copy the class file in the tmp location with a non unicode name. It don't like it too much but Java accepts unicode chars in class names so it makes sense for the plugin to do the same. So now unicode characters anywhere in the class file path including the class name ore ok. Spaces in the file name are fine too.

Also did some refactoring in decompile.cpp as there was mixed usage of char and WCHAR and now all paths are WCHARs only.

I realize that most of the windows C++ devs are mostly familiar with VC++ (I am one of them) but I used Eclipse C++ just for the fun of learning something new. I am planning to add basic user configuration sometimes (I hope sooner rather than later) in the next major release and it will most probably be a VC++ project.
User avatar
XPEHOPE3KA
Power Member
Power Member
Posts: 854
Joined: 2006-03-03, 18:23 UTC
Location: Saint-Petersburg, Russia

Post by *XPEHOPE3KA »

2yyang
2esandrei
Thanks for fixing this, it works now.
F6, Enter, Tab, F6, Enter, Tab, F6, Enter, Tab... - I like to move IT, move IT!..
jmwap
Member
Member
Posts: 121
Joined: 2008-03-23, 12:40 UTC

Post by *jmwap »

EDIT: a restart brought order into things.

suddenly F3 shows the usual lister, and is not using this very useful plugin. I am not sure I have changed anything.

What is the best way to debug this? I am already missing looking into any class file, was so handy!!

thanks
daobi
New Member
New Member
Posts: 1
Joined: 2015-10-16, 08:06 UTC

Post by *daobi »

After a successful automatic installation of tc_jad_plugin-1.1.zip into
c:\Program Files\totalcmd\plugins\wlx\tc_jad_plugin\
lister doesn't show decompiled class files.

After installing into a path without spaces (c:\dev\totalcmd\plugins\wlx\tc_jad_plugin\) lister shows decompiled java classes correctly.

Can you provide a bugfix please?
Thanks in advance
Aleq
Junior Member
Junior Member
Posts: 55
Joined: 2006-06-07, 07:24 UTC
Location: CZ, EU

Re: TC JAD Java Decompiler Plugin - See class files as java code

Post by *Aleq »

Hi,
anybody has a local copy or mirror of the plugin? The hosting server has been down for several days and I can't find it anywhere else.

Thanks a lot,
A.
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Re: TC JAD Java Decompiler Plugin - See class files as java code

Post by *Ovg »

It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
mikedepetris
Junior Member
Junior Member
Posts: 84
Joined: 2006-11-07, 16:36 UTC
Location: Trieste, Italy
Contact:

Re:

Post by *mikedepetris »

daobi wrote: 2015-10-16, 08:14 UTC After a successful automatic installation of tc_jad_plugin-1.1.zip into
c:\Program Files\totalcmd\plugins\wlx\tc_jad_plugin\
lister doesn't show decompiled class files.

After installing into a path without spaces (c:\dev\totalcmd\plugins\wlx\tc_jad_plugin\) lister shows decompiled java classes correctly.

Can you provide a bugfix please?
Thanks in advance
I confirm it must be placed in a path without spaces
ChristianGruen
Junior Member
Junior Member
Posts: 28
Joined: 2008-09-14, 15:45 UTC

Re: TC JAD Java Decompiler Plugin - See class files as java code

Post by *ChristianGruen »

I would still love to have an option to change the display font. Is there any chance that someone could provide such an option in the ini file?

Thanks in advance,
Christian
lambda
Junior Member
Junior Member
Posts: 2
Joined: 2020-01-23, 09:57 UTC
Location: Ticino, Switzerland

Re: TC JAD Java Decompiler Plugin - See class files as java code

Post by *lambda »

There is also this convenient online Java decompiler that does not require download and installation.




http:// www decompiler com/

URL deactivated by moderator
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: TC JAD Java Decompiler Plugin - See class files as java code

Post by *Dalai »

2esandrei
I've been using this plugin for quite some time now. Thanks for the work you've put into it!

Yesterday I wanted to use the plugin again and it didn't work. It required some troubleshooting work, but now I know that it's a major bug that caused it to stop working. Via Sysinternals Process Monitor I was able to catch jad.exe's command line:

Code: Select all

"E:\Programme\Total Commander\Plugins\tc_jad_plugin\jad" -lnc -o -s "-1074404124.java" "-1074404124"
When starting jad.exe directly with such a command line it just shows its usage information, hence doesn't create any output file. Yes, I'm aware that the plugin copies the .class file to its plugin directory, so I did that manually before calling jad.exe. It's caused by the dash (or minus sign), probably because jad.exe thinks that another switch is following, which is not the case. Unfortunately jad.exe doesn't support something like a double dash (--) to mark the end of all switches like many Linux tools do.

I then inspected your source code, and I think that you should use an unsigned data type for saving the GetCurrentTime's return value to create the temporary file name (maybe call _ultow() instead of _itow()). Or at least call abs() function to ensure that there are no leading dashes in the name.

And while I'm at it: I highly recommend that you copy the .class file to the %TEMP% directory instead of the plugin directory. This way, the plugin could also work in environments where users don't have write permission to the plugin directory (e.g. when it's installed somewhere in %ProgramFiles%\Total Commander or similar). Maybe make it configurable via lsplugin.ini.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: TC JAD Java Decompiler Plugin - See class files as java code

Post by *Dalai »

2esandrei
Since you didn't react in any way for one month, I just tried to send you an email to the Yahoo address that's mentioned in the plugin's readme.txt. All I got was a "Mail delivery failed":

Code: Select all

SMTP error from remote server for TEXT command, host: mta5.am0.yahoodns.net (67.195.204.72) reason: 554 delivery error: dd Not a valid recipient - atlas312.free.mail.bf1.yahoo.com
Please change the email address to a valid one.

Does anyone have any way to contact eSandrei? If so, it would be great if one could point him to this thread again, and the bug I reported.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Aleq
Junior Member
Junior Member
Posts: 55
Joined: 2006-06-07, 07:24 UTC
Location: CZ, EU

Re: TC JAD Java Decompiler Plugin - See class files as java code

Post by *Aleq »

Seems to be abandoned. Too bad, it's really very convenient for Java developers...
User avatar
nsp
Power Member
Power Member
Posts: 1803
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: TC JAD Java Decompiler Plugin - See class files as java code

Post by *nsp »

I also miss it but even if it is not as convenient as tc_jab cfr is for me the most accurate java de-compiler.
You can make a button with a batch/script/... or try to integrate into anycmd...
Post Reply