Using WebSphere studio device developer smart linker

The smart linker tool that ships with WebSphere Studio Device Developer is used in the process of building and packaging an application into a jar or jxe file. The smart linker can remove classes (and methods) that are deemed not to be required; this will happen to classes that are dynamically loaded. WebSphere MQ Everyplace makes use of dynamic loading so care should be taken to either avoid this feature or to explicitly name classes that must be present, even though not explicitly referenced in the code.

To prevent unused classes being removed use the - noRemoveUnused option. If the -removeUnused option is set then any class that is dynamically loaded must be specifically included. One option that can be use to achieve this is -includeWholeClass. For example -includeWholeClass "com.ibm.mqe.adapters.*" will include all classes in the adapters package and -includeWholeClass "com.ibm.mqe.adapters.MQeTcpipHttpAdapter" will only include the http adapter. Multiple include (or exclude) options can be specified in the smart linker options file.

The following guidelines can be used to determine which classes are dynamically loaded. The basic guideline is any class that is referenced though an WebSphere MQ Everyplace class alias or any class that is set as a parameter when administering WebSphere MQ Everyplace resources will be dynamically loaded. This includes:

An example of a set of includes needed for a simple MIDP application is:

-includeWholeClass "com.ibm.mqe.MQeQueue" 
-includeWholeClass "com.ibm.mqe.MQeRemoteQueue" 
-includeWholeClass "com.ibm.mqe.MQeHomeServerQueue" 
-includeWholeClass "com.ibm.mqe.MQeTransporter" 
-includeWholeClass "com.ibm.mqe.communications.MQeConnectionDefinition" 
-includeWholeClass "com.ibm.mqe.adapters.MQeMidpFieldsAdapter" 
-includeWholeClass "com.ibm.mqe.adapters.MQeMidpHttpAdapter" 
-includeWholeClass "com.ibm.mqe.messagestore.MQeMessageStore" 
-includeWholeClass "com.ibm.mqe.registry.MQeFileSession"


© IBM Corporation 2002, 2003. All Rights Reserved