Core issue: how to compile a third-party class library jar package into a blackberry class library cod file that can be installed.
Note: In some cases, there are no third-party class library source code and only jar packages. You do not need to decompile the class files.
The most important step to solve the problem: Use the BB-ant-tools ant script tool to compile a third-party class library jar package into a blackberry class library cod file that can be installed.
Environment: blackberry_jde_pluginfull_1.1.1, built-in net. Rim. ejde. componentpack4.5.0 _ 4.5.0.21.
Bytes ------------------------------------------------------------------------------------------
Step 1: Create a blackberry project and test the application. The module not found or class not found error is found.
Start ejde 1.1 and create a blackberry Project
Project name stockquote
Create directory lib
Download the kSOAP MIDP jarfile ksoap-midp.zip, copy it to Lib, rename it as ksoapmidp. Jar (remove the intermediate-, and change the file suffix zip to jar)
Http://ksoap.objectweb.org/software/downloads/
Choose project> JAVA build path> libraries> Add jars
Select the project stockquote, select the directory Lib, and select the file ksoapmidp. jar.
Click the eclipse menu run --> RUN deployments...
Create a new BlackBerry simulator configuration, hook up the stockquote project in the projects column, and hook up "launch mobile data system Connection Service (MDS-CS) with Simulator" in the simulator Column
Click Run.
Click the stockquote icon in the simulator to report an error.
JVM error 104
Uncaught runtimeexception
Error starting stockquote: module 'ksoapmidp "not found.
Simulator selection menu Simulator --> USB cable connected
Run the javaloader-u dir> a.txt command in the DOS window.
We found that the module in the simulator only has stockquote and does not have ksoapmidp.
Name version size created
--------------------------------------------------------------------------------------------
...
Stockquote 1.0.0 2268 wed Feb 10 12:50:52 2010
Bytes ------------------------------------------------------------------------------------------
Step 2: preverify third-party class libraries
If preverify is not performed, the following error occurs occasionally during ant job execution: [rAPC] org. kSOAP. classmap: Error! : Missing stack map at label: 59
Reference: http://www.blackberryforums.com/developer-forum/130803-missing-stack-map-label.html
Copy ksoapmidp. jar to the C:/TEMP directory.
Set jde = C:/tools/blackberry_jde_pluginfull_1.1.1/plugins/net. Rim. ejde. componentpack4.5.0 _ 4.5.0.21/components
Set Path = % jde %/bin; % PATH %
Cd c:/temp
Preverify-verbose-D.-classpath % jde %/lib/net_rim_api.jar ksoapmidp. Jar
Bytes ------------------------------------------------------------------------------------------
Step 3: Use the BB-ant-tools ant script tool to compile a third-party class library jar package into a blackberry class library cod file that can be installed
Download: BB-ant-Tools
Http://bb-ant-tools.sourceforge.net/click the downloads button
Example: http://downloads.sourceforge.net/project/bb-ant-tools/bb-ant-tools/1.2.4/bb-ant-tools-1.2.4-bin.zip? Use_mirror = NCU
Download: Apache ant
Http://ant.apache.org/bindownload.cgi
Example: http://apache.etoak.com/ant/binaries/apache-ant-1.8.0-bin.zip
Copy bb-ant-tools.jar to C:/tools/Apache-ant-1.8.0/lib
Compile a build. xml file under the C:/TEMP directory.
Note:
1) destdir = "C:/Temp"
This directory c:/temp must be an existing Directory; otherwise, keep build. xml: 14: destdir must be a directory during ant execution.
2) <include name = "ksoapmidp. Jar"/>
<! -- Here must be relative directory, otherwise ant report:
Build. xml: 14: srcdir attribute or <SRC> element required! -->
Set ant_home = C:/tools/Apache-ant-1.8.0
Set java_home = C:/tools/jdk1.6.0 _ 17
Set Path = % ant_home %/bin; % PATH %
Set jde = C:/tools/blackberry_jde_pluginfull_1.1.1/plugins/net. Rim. ejde. componentpack4.5.0 _ 4.5.0.21/components
Set Path = % jde %/bin; % PATH %
Cd c:/temp
Ant
Tip:
[RAPC] C:/temp/ksoapmidp. Jar (ORG/kxml/parser/abstractxmlparser. Class): 0: Warning! : Local variable (s) {local #2} initialized but not used in: org. kxml. pars
Er. abstractxmlparser. readtree (vector)
[RAPC] populating
[RAPC] no errors.
Build successful
Total time: 7 seconds
Bytes ------------------------------------------------------------------------------------------
Step 4: manually install the generated module ksoapmidp into the simulator to test
Simulator selection menu Simulator --> USB cable connected
Run the javaloader-u load ksoapmidp. Jad command in the DOS window.
Tip:
Rim wireless handheld Java Loader
Copyright 2001-2007 Research In Motion Limited
Connected
Loading ksoapmidp. Jad done
27544 bytes sent ~ 220352 BPS
Disconnected
The Application of ksoapmidp can be seen in the simulator.
Or
Javaloader-u dir can also be seen
Now you can click the stockquote icon in the simulator to run the program supporting the ksoapmidp class library.
--------------------------------------------
Step 5 A: package the third-party class libraries and applications in the alx format. You can use the Desktop Manager or BES push to release these libraries in the future.
Copy all the files under C:/temp/to C:/BB. Dev/workspace. mywork/stockquote/deliverables/4.5.0.
Edit blackberry_app_descriptor.xml, select the build column, and check "Generate. alx file (desktop deployment/bes push )"
Choose eclipse> Project> BlackBerry> package project (s)
Edit the generated alx file,
Modify <files>
Stockquote. COD
</Files>
Is
<Files>
Ksoapmidp. COD
Stockquote. COD
</Files>
--------------------------------------------
Step 5 B: Package third-party class libraries and applications in the Jad format, which can be released through Ota in the future.
Copy all the files under C:/temp/to C:/BB. Dev/workspace. mywork/stockquote/deliverables/4.5.0.
Choose eclipse> Project> BlackBerry> package project (s)
Edit the generated JAD file
<? XML version = "1.0" encoding = "UTF-8"?>
<Project name = "stockquote" default = "buildlibrary" basedir = ".">
<Property name = "jdehome" location = "C:/tools/blackberry_jde_pluginfull_1.1.1/plugins/net. Rim. ejde. componentpack4.5.0 _ 4.5.0.21/components"/>
<Property name = "javahome" location = "C:/tools/jdk1.6.0 _ 17"/>
<Taskdef resource = "bb-ant-defs.xml" classpath = "lib/bb-ant-tools.jar"/>
<Target name = "buildlibrary" Description = "build ksoapmidp library for BlackBerry">
<RAPC jdehome = "$ {jdehome }"
Jdkhome = "$ {javahome }"
Destdir = "C:/Temp"
Output = "ksoapmidp"
Quiet = "false">
<Jdp type = "library"
Title = "ksoapmidp"
Vendor = "kSOAP Porject"
Version = "1.20"
Description = "ksoapmidp library"
Arguments = ""
Systemmodule = "false"
Runonstartup = "false"
Startuptier = "7"
Ribbonposition = "0"
Icon = "">
</Jdp>
<SRC>
<Fileset dir = ".">
<Include name = "ksoapmidp. Jar"/>
</Fileset>
</Src>
</RAPC>
</Target>
</Project>