Problem

When an application is loaded onto a device or simulator an error is thrown that is similar to the following:

Error Starting module_name: Class ‘class_name’ multiply defined


Cause

This error is thrown when more than one module on the device defines a class with the same name and package structure as another module on the device.

For example application A and application B both have a class defined as

com.multiplydefined.utilities.MyClass;

Note: All classes must be uniquely identifiable to prevent this error from occurring.

Resolution

If the instances of multiple classes are used by different applications you are developing

Use a library in which all common classes are defined and include this library with each application that requires access to the shared classes. This way, only one instance of the classes will ever be installed at one time, preventing this error from being thrown.

If the multiple class instances occur between your application and another third-party application

Ensure that all package names are unique by using identifiers that would not be used by other companies. One recommendation is to use your company’s web site in reverse for the package structure.For example if the company web site is www.mycompany.com, then start all packages with com.mycompany.

Because the web site URL is unique to your company, it makes sure that the package structure of your application is unique as well.

[1] http://supportforums.blackberry.com/t5/Java-Development/Application-throws-quot-multiply-defined-quot-error-at-start-up/ta-p/501498