Jode

2006 May 11 at 02:52 » Tagged as :

Proguard has long been my favourite obfuscator/optimizer. That doesn't mean I have been faithful. I have cast wishful eyes at other obfuscators.

Now my attention has been attracted by jode. Getting close to Jode is painful. Ran into trouble straight away, caused by a missing gnu getopt. This has to be downloaded compiled manually and added to your class path yum will not help. Otherwise you get this:

checking for gnu.getopt... no

configure: error: You need gnu getopt for java.

Once you have done so, you can configure and then type make. Make results in the following error if you are using a version of Java more recent than 1.3

Wrong major 0 at ../javaDependencies.pl line 88.

To get rid of the error simply delete this line! then you will see the next error.

make[2]: Entering directory `/dev/shm/jode-1.1.2-pr/jode/bytecode'

/usr/java.5/bin/javac -classpath ../..:../..:/dev/shm/:/usr/java.5/jre/lib/rt.jar -d ../.. BinaryInfo.java

../../jode/bytecode/ClassInfo.java27: as of release 1.5, 'enum' is a keyword, and may not be used as an identifier

(try -source 1.4 or lower to use 'enum' as an identifier)

final Enumeration enum =

I also used to have this bad habit of using enum as a name for a variable. Now I use iter as the identifier instead of enum, hopefully they will not make that a keyword in java 7. The simplest thing to do at this stage is to switch to java.4 that's when I started to get errors about the wrong major again. So the obvious thing to do a make clean and start again. Unfortunately there isn't a make clean. You have to delete the whole folder, unzip and start again. Trouble doesn't end there

bad class file: /dev/shm/gnu/getopt/LongOpt.class

class file has wrong version 49.0, should be 48.0

Please remove or make sure it appears in the correct subdirectory of the classpath.

This is because getOPt was compiled with version 1.5, now to change the Makefile to use java.4. When that was it, jode did compile (at last) but execution still results in an error

Exception in thread "main" java.lang.NoClassDefFoundError: jode/decompiler/Main

Obviously it's now a simple matter of fixing the classpath but where the hell are the class files? Stick with progaurd? let's first look at the binary version that is also available for download.