Sun Microsystems Computer Accessories manual Example

Page 70

run(File jarFileObfuscated, String wtkBinDir,

String wtkLibDir, String jarFilename, String projectDir, String classPath, String emptyApi)

where

jarFileObfuscated is the file that holds the obfuscated JAR wtkBinDir is the directory holding the Wireless Toolkit binary files wtkLibDir is the directory holding the Wireless Toolkit JAR files jarFilename is the full path to the JAR file to be obfuscated projectDir is the full path to the main directory of your project

classPath is the full path to the set of files that make up the API classpath for the project based on your API selections in the Project Settings dialog box, for example, the paths for the cldcapi10.jar and midpapi20.jar files.

emptyApi is the full path to the version of the MIDP API containing stub methods (that is, method signatures without method bodies) in the {j2mewtk.dir}\wtklib directory

The first method creates a script file that is used by most obfuscators as a method of input to determine which classes and methods are not to be obfuscated. The second method is called when the Wireless Toolkit attempts to execute the obfuscator.

2.You must add the following properties to the ktools.properties file located in {j2mewtk.dir}\wtklib\Windows:

obfuscator.runner.class.name. The fully qualified name of the class implementing the obfuscator interface. This property tells the Wireless Toolkit the class name it needs to load to execute the obfuscator.

obfuscator.runner.classpath. The location of the implementation class. The location can either be a directory path (absolute or relative to {j2mewtk.dir}) or a .jar or .zip filename.

obfuscate.script.name. The name of a static script file that you use to append to your script which is generated through the createScriptFile() method.

Example

For example, the Wireless Toolkit has an implementation that executes the ProGuard obfuscator. The class name is com.sun.kvem.ktools.RunPro and it is located in the ktools.zip file in the wtklib directory. The properties’ values are:

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

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

obfuscate.script.name: ignore.rgs

56 Wireless Toolkit Basic Customization Guide • December 2003

Image 70
Contents Basic Customization Guide Please Contents Examining Device Property Files Default Emulator Device Property Files Vi Wireless Toolkit Basic Customization Guide December Figures Viii Wireless Toolkit Basic Customization Guide December Tables Wireless Toolkit Basic Customization Guide December Who Should Use This Book How This Book Is OrganizedUsing Operating System Commands Shell Prompts Typographic ConventionsRelated Documentation Accessing Sun Documentation Online Sun Welcomes Your CommentsCustomizing the Wireless Toolkit How to Customize the Wireless ToolkitDevice Property Files and the Default Emulator Customization StepsCustomizing the Wireless Toolkit Wireless Toolkit Basic Customization Guide December Creating Device Property Files Make a Copy of an Existing Main Device Property FileObtain and Enter Image Files Obtain and Enter the Screen Properties Screen LocationTotal Screen Size Display AreaDisplay Area in Full Screen Mode Specifying Screen PropertiesObtain and Enter the Button Properties By measuring the image file, obtain the button propertiesHeight Width Obtain and Enter Soft Button Label Areas Soft button label display is defined by a line of the form Obtain and Enter Icon Properties Defining the Icon Location and StatesEnter the following measured values for the icons properties Run the Emulator for the New Device Enter Color PropertiesScreen Background RGB Color Examining Device Property Files Device Property Files Fonts Main Device Property FileFonts Used by the Midp APIs System Fonts Default FontBitmap Fonts Ascii character Distance to character Font Underlining Device ImageImage with Buttons Highlighted and Backlight On Image without Buttons PressedImage with Buttons Pressed ScalingScreen Properties Screen Location Total Screen Size Display Area in Full Screen ModeDisplay Area Screen Pixel Ratio Screen Background ColorTouch Screen Screen Border ColorScreen Buffering Keyboard Handler Device ButtonsDefining a Device Button Button.LEFT = 13, 197, 20 Assigning a PC Keyboard Key to a Button Assigning a Game Action to a Button Specifying the Characters Generated by a Button PressAssigning Abstract Commands to Buttons Abstract Command Types in Order of PrecedenceEmulating Abstract Command Button Assignments Precedence of Assigning Commands to a Button Secondary Button Assignments Abstract Command Menu Displayed Icons Defining the Icon Location and StatesSoft Button Label Display Soft Button Labels on the Emulated Device DisplayColor Sound AlertsDevice Software Capabilities Alert Type ValuesLocales Character EncodingsEnableAlphaChannel false Transparent ImagesWireless Toolkit Basic Customization Guide December Default Emulator Device Property Files Property FilesDefaultGrayPhone.properties Appendix a Default Emulator Device Property Files Wireless Toolkit Basic Customization Guide December Appendix a Default Emulator Device Property Files Wireless Toolkit Basic Customization Guide December # alert.alerttype.sound soundfile Wireless Toolkit Basic Customization Guide December Device Image Files Icon Image FilesIcon Image Files Support for ByteCode Obfuscators Adding a ByteCode ObfuscatorExample Appendix B Support for ByteCode Obfuscators Wireless Toolkit Basic Customization Guide December P E N D I X C Wireless Toolkit Basic Customization Guide December Index Keyboard.handler property Device property files, 1 WMA messages, customizing Wireless Toolkit Basic Customization Guide December