Java ME Wireless Toolkit Obfuscator Plugin
Zelix KlassMaster provides an obfuscator plugin to the Sun Java ME Wireless Toolkit to allow you to obfuscate your
Java ME MIDlets with a mimimum of effort. However, note that you can avoid the use of a plugin by obfuscating after preverification.
Please see the Java ME Obfuscation Tutorial for more detail.
This rest of this document is organized into the following sections.
Setting up the Zelix KlassMaster plugin involves editing the Wireless Toolkit
Location of the
ktools.properties file should be edited as follows
<path to ZKM.jar>ZKM.jar
<path to ZKM.jar> can be absolute or relative. If it is relative, it should be relative to
Note that, in the Windows environment, if the
obfuscator.runner.classpath value contains path separators then they must be escaped.
For example, the path "
c:\Projects\ZKM.jar" must be entered as "
obfuscator.script.name entry in the
ktools.properties file is not used by the Zelix KlassMaster plugin.
If it is present in the file you can leave it unchanged or you can comment it out using a leading "#" character.
You should not have to add, delete or modify any other entries.
You run the plugin from the Java ME Wireless Toolkit KToolBar. The steps are
The obfuscated JAR file and the updated JAD will be in your project directory.
The Zelix KlassMaster plugin sets its default directory to the project directory of the project you have opened within the KToolBar.
So the Zelix KlassMaster log file
- Start the Java ME Wireless Toolkit KToolBar application
- Open your project
- Select the KToolBar "Project | Package | Create Obfuscated Package" menu option
ZKM_log.txt and change log
ChangeLog.txt will be written there.
Zelix KlassMaster will also look in the project directory for the default exclusion file
defaultExclude.txt and the
default trim exclusion file
By default, the plugin will use the following internal ZKM Script which aims at a balance between size and protection against decompilation.
You can provide your own ZKM Script by putting it in a file named
trimExclude public *.* extends javax.microedition.midlet.MIDlet;
//Toolkit doesn't allow JAD to be updated so MIDlet package names must not be changed.
exclude public *.^* extends javax.microedition.midlet.MIDlet;
script.txt in your project directory.
You could achieve further size reduction (at the expense of protection) by setting the ZKM Script obfuscate statement's "obfuscateFlow" parameter to "none"
to switch off flow obfuscation.
However, your script shouldn't specify
because these must be provided by the plugin. It would be a good idea to use the default script above as a model.