Question : J2me Gaming : Problem with Creating build(jar) for nokia phones

Hi,

I am having trouble in making a package (jar) for  nokia phones. I have been tring using J2ME wireless kit, Eclipse, Nokia development Suite and IBM Device developer but havent been able to make a perfect package out of it.

I have even downloaded the plugins for Eclips but not able to configure it properly. I did every thing according to the specifications. but while building project i get the error "Problem while running the build script ....." .

Overall i want create a jar package and obufuscate that for Nokia phones.Its real urgent. Wud want someone to guide me on all the necessary.

Thanks in advance.

Answer : J2me Gaming : Problem with Creating build(jar) for nokia phones

Antenna is an extension for Ant.  In order to use the Antenna facilities (eg. the targets for creating JADs, building, packaging, obfuscating etc.), you need to declare the targets in your Ant build file (build.xml).

Here is a same Ant build file that is a cut-down version of one I'm currently using.  This includes the Wireless Messaging API for Nokia 3410 (just to demonstrate how to include external libraries):

The wtkjad task is used to create the initial JAD file for the MIDlet.
The wtkpreprocess task handles the parts of the source that are conditionally included using the #ifdef support provided by Antenna, eg. in this case the following code:

//#ifdef WMA_ENABLED
import javax.wireless.messaging.MessageConnection;
import javax.wireless.messaging.TextMessage;
//#endif

is included.  If the symbols="WMA_ENABLED" text is missed, the preprocessor changes the above code to:

//#ifdef WMA_ENABLED
//import javax.wireless.messaging.MessageConnection;
//import javax.wireless.messaging.TextMessage;
//#endif

The preprocessed source code is now in the preproc directory and the wtkbuild task compiles this into the target directory using the bootclasspath to use the Nokia APIs rather than the standard ones.  I've also set the preverification within this task too.

The wtkpackage task then builds the JAD and JAR files, updating them with extra info (eg. config and profile), preverifies again (no particular reason for this) and obfuscates the JAR.  Note that the JAR file includes all the files in the target directory and the res (resource) directory except those specified by the excludes clause.



 
 
 
 
 
  />
 
 
 
 
 

 
   
   
   
   
 

 
 
   
   
 

 
  >
                jarfile="${target_dist}/MyProject.jar"
            name="MyProject"
            vendor="Objective Software Services Ltd."
            version="${version}">

                        icon="/images/icon.png"
                class="com.ossltd.MyProject"/>
   


                       destdir="${preproc}"
                   symbols="WMA_ENABLED"/>
   
                  destdir="${target}"
              preverify="true"
              bootclasspath="${nokiaWMA}"/>

                    jadfile="${target_dist}/TrainFinder.jad"
                bootclasspath="${nokiaWMA}"
                config="CLDC-1.0"
                profile="MIDP-1.0"
                obfuscate="true"
                preverify="true">
       
         
       

       
         
       

   

 

Random Solutions  
 
programming4us programming4us