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

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\]
Reading library jar [c:\WTK20\lib\]
Reading library jar [c:\WTK20\lib\]
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.


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 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 archive with the command:
jar -uvf c:\wtk20\wtklib\ RunPro.class

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

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


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