|
integrating eclipseME and BlackBerry SDK -
08-15-2006, 03:54 PM
Hi All,
My team is about to port J2ME app to BlackBerry. The J2ME app was developed on Eclipse using EclipseME (for mobile) and the team does not want to use the "crappy" JDE comes with the BlackBerry SDK. So as a new guy, I got the task. I think I figure out a relatively painless way of doing this and I'd like to share with you all.
I assume you have been using eclipseME for mobile development so I will skip all the unneccessary details regarding eclipseME ([eclipseme.org]).
1) Create a eclipseME HelloWorld project.
2) On the buildpath, add a reference to external JAR file, net_rim_api.jar.
3) Export the attena build files (right click on the project, J2ME->export antenna).
4) Added the following to user-build.properties (with the correct SDK path)
bb.buildjars.home=C\:\\Java\\j2me\\RIM\\BB_JDE_4.1 \\bin
bb.simulator=C\:\\Java\\j2me\\RIM\\BB_JDE_4.1\\sim ulator
bb.api.jar=C\:\\Java\\j2me\\RIM\\BB_JDE_4.1\\lib\\ net_rim_api.jar
5) Added the following line to HelloWorld.jad if you are using RIM UIApplication (very important, it took me a couple of hours to debug this), MIDlet-1: HelloWorld (for J2ME midlet, it is automatically added when u package the JAR file).
5.5) Needs to create HelloWorld.alx file:
<loader version="1.0" />
<application id="HelloWorld">
<description>Sample app</description>
<version>1.0</version>
<vendor>My vendor</vendor>
<fileset Java="1.0">
<files>HelloWorld.cod</files>
</fileset>
</application>
</loader>
6) Add the following targets to the build.xml exported by J2ME:
<!-- Package up for black berry debugging -->
<target name="bb_build" depends="jar" description="Package for black berry debugging">
<echo message="path.build.output=${path.build.output}" />
<wtkrapc jadfile="${path.build.output}/${midlet.name}.jad" source="${path.build.output}/${midlet.name}.jar" codename="${midlet.name}" import="${bb.api.jar}" destdir="${path.build.output}/cod" midlet="false" />
<antcall target="bb_copy" />
</target>
<!-- copy files to bb simulator -->
<target name="bb_copy" description="Copy files to BB simulator" >
<copy todir="${bb.simulator}" overwrite="true">
<fileset dir="${basedir}">
<include name="*.cod" />
<include name="*.debug" />
<include name="*.alx" />
<include name="*.cso" />
</fileset>
</copy>
</target>
<!-- unload the midlet to the black berry device -->
<target name="bb_unload" description="Unload the midlet to the BB device.">
<exec executable="${bb.buildjars.home}\javaloader.exe">
<arg line="-usb erase ${midlet.name}.cod" />
</exec>
</target>
<!-- load the midlet to the black berry device -->
<target name="bb_load" depends="bb_unload" description="Load the midlet to the BB device.">
<exec executable="${bb.buildjars.home}\javaloader.exe">
<arg line="-usb load ${basedir}\${midlet.name}.cod" />
</exec>
</target>
7) To debug, first u need to execute bb_build, then you need to start(create) a Java Remote Application session. See [www dot blackberry dot com/developers/forum/thread.jsp?forum=1&thread=7730&message=28238&q=ecl ipse#28238] for reference. (The forum does not allow me to post URL until I have more than 10 posts hence the dot).
I think that should cover it. I am in the process of convicing the eclipseME owner to do the BlackBerry plugin or helping me getting started. Until then, you will need to add one extra step (bb_build) before you can debug.
Note: I have yet to figure out how to do internationalization for BB app (.rrh) on eclipse. Might be someone can share his/her experience.
Cheers,
Tom
Last edited by ppngiap : 08-15-2006 at 04:19 PM.
|