Print this page.  If your browser doesn't allow JavaScript, right-click this page and choose Print from the popup-menu.        
Packaging Mimer JDBC MIDlets
Categories: JDBC, Mobile
Introduction

This article will describe a solution to a packaging problem that may arise when using an application produced with the Sun Wireless Toolkit. The error message is "Wrong name".

Version 2.0 of the Sun Wireless Toolkit includes a plug-in for the ProGuard obfuscator. Unfortunately, if the resulting application has more than 26 classes in a single package, the obfuscation produces incorrect results on Windows platforms. The Mimer JDBC driver contains more than 26 classes and any attempt to package a Mimer JDBC MIDlet will therefore fail.

The symptoms of the problem is seen when the package is preverified. The given error message is "Wrong name".

Project "MimerDemo" loaded
Project settings saved
Building "MimerDemo"
ProGuard, version 1.6
Reading program jar [c:\WTK20\apps\MimerDemo\bin\MimerDemo.jar]
Reading library jar [c:\WTK20\lib\mmapi.zip]
Reading library jar [c:\WTK20\lib\wma.zip]
Reading library jar [c:\WTK20\lib\midpapi.zip]
Writing output jar [C:\DOCUME~1\robert\LOCALS~1\Temp\MimerDemo.jar]...
Adding resources from jar [c:\WTK20\apps\MimerDemo\bin\MimerDemo.jar]
Warning: duplicated input class [javax/microedition/media/protocol/DataSource]
Error preverifying class com.mimer.jdbc.d
Class loading error: Wrong name
com.sun.kvem.ktools.ExecutionException: Preverifier returned 1
Build failed
com.sun.kvem.midletsuite.InvalidJadException: Reason = 31
The jar size value in the Application Descriptor does not match the real jar file size.



Solution

To correctly package your Mimer JDBC MIDlet with ProGuard obfuscation, perform the following steps.

1. Download the ProGuard plug-in RunPro.class (right-click and 'Save Link Target As...'), which uses the ProGuard option -dontusemixedcaseclassnames to avoid generating class names with capital letters. This will destroy the final JAR-structure since the Windows file system is case insensitive.

2. Insert the plug-in into the ktools.zip archive. The documentation says that the ktoolbar tool should use the obfuscator.runner.classpath property but our experiences show that it doesn’t. Instead, we add our plug-in directly to ktools.zip archive with the command:
jar -uvf c:\wtk20\wtklib\ktools.zip RunPro.class


3. Modify the obfuscator.runner.class.name property to use the new plug-in. This property is found in the {j2mewtk.dir}\wtklib\Windows directory. Change the line starting with obfuscator.runner.class.name to:
obfuscator.runner.class.name: RunPro


4. You should now be able to package your Mimer JDBC MIDlets.



Links

To use the created Mimer JDBC MIDlet package, see the article Java programming for mobile phones with Mimer SQL.


Last updated: 2007-03-23

 

Powered by Mimer SQL

Powered by Mimer SQL