Sun Microsystems J2ME manual Obfuscate.script.name scriptfile

Models: J2ME

1 134
Download 134 pages 62.02 Kb
Page 28
Image 28

3.Uncompress the proguard.jar file from the lib directory of the ProGuard installation to the bin directory of your J2ME Wireless Toolkit installation.

Once ProGuard is installed, you can use it by choosing Project > Package > Create Obfuscated Package.

In some cases you will need to provide a script file that controls how the obfuscator works. If you are loading classes using Class.forName(), for example, you need to tell ProGuard to leave the class names unchanged.

Create a script file using a text editor, then save it under the project’s main directory. Consult the ProGuard documentation for information on script files. Next you need to tell the toolkit how to find this file. To do this, edit {toolkit}\wtklib\{platform}\ktools.properties, where {platform} is the name of your underlying platform (most likely Windows or Linux). Add a line as follows:

obfuscate.script.name: scriptfile

Replace “scriptfile” with the name you used for the script file. You will need to quit and restart KToolbar for the change to take effect.

The J2ME Wireless Toolkit also includes support for RetroGuard. If you want to use RetroGuard, you’ll need to download it separately and change the toolkit’s configuration.

1.Go to the RetroGuard web site, http://www.retrologic.com/retroguard- main.html.

2.Download the latest version.

3.Extract the retroguard.jar file from downloaded zip file to the bin directory of your J2ME Wireless Toolkit installation.

4.Edit {toolkit}\wtklib\{platform}\ktools.properties so that it uses the RetroGuard obfuscator plug-in:

obfuscator.runner.class.name: com.sun.kvem.ktools.RunRetro

obfuscator.runner.classpath: wtklib\\ktools.zip

Retroguard will be used when you create an obfuscated package.

To switch back to ProGuard, edit the obfuscator lines in the ktools.properties file as follows:

obfuscator.runner.class.name: com.sun.kvem.ktools.RunPro

obfuscator.runner.classpath: wtklib\\ktools.zip

If you want to use a different obfuscator, you’ll have to implement an obfusctor plug-in yourself. See the J2ME Wireless Toolkit Basic Customization Guide for an example of how to implement an obfuscator plug-in.

16 J2ME Wireless Toolkit User’s Guide • October 2004

Page 28
Image 28
Sun Microsystems J2ME manual Obfuscate.script.name scriptfile