Saturday, July 9, 2011

eRCP, windows mobile 6, phoneMe, J9 fruit salad

I was asked to investigate a geopaparazzi port on Trimble Juno SC. Well, obviously it is not Android. But not only that, it is also not open source at all. In fact it is one of the closest source situations I have been in many years. Anyways, while investigating all the .Net and C# and gps apis, I also gave a look at a project I fell in love with long time ago, but never really had the possibility to try: eRCP.

To be honest the project looked quite dead and it took me a really long time to figure out the current way to do things best.

The best thing right now is to download the Pulsar eclipse IDE project
and install the ERCP SDK through the update site, which now is: http://www.eclipse.org/ercp/pulsar. At that point the sdk is installed.

At that point the docs tell to go under preferences->target platform and define a new target platform based on a new eRCP template. That will take the internal sdk and load it as target platform to develop against. Well, later I found out that it didn't work for me.
What worked instead was to download:
- the ercp sdk
- the win32 runtime
- the windows mobile runtime
and add those to the target platform configuration. At that point I was ready to develop.

First thing I wanted to run the demo codes, that can be found in the ercp cvs at dev.eclipse.org.

So simply create a cvs repo with:
host = dev.eclipse.org
repo path = /cvsroot/rt
using anonymous user and browse the HEAD into the org.eclipse.ercp folder to checkout as a project the org.eclipse.ercp.app application. That way you can run the example applications on your windows pc.

Obviously you want to run them on the mobile devide. Ok, that was trickier.

First thing you need to upload top the device (let's say in the root folder) the eRCP folder that can be found inside the windows mobile runtime downloaded before. That one contains also the example runner files.

The few examples found all make use of the J9 IBM environment to run the eRCP demos. Well, that one is not open source and also not free right now. But it seemed the only possible way to go. I tried to use the J9 bundle that gvSig mobile is using but was not successful. Being in need to really know if eRCP is a way to go, I finally decided to buy the J9 environment (I hate to buy things when I don't even know if I will ever need them!). Once bought, I installed it on the Juno and was looking forward to see the examples work.

Well, that also didn't happen. The launcher crashed and I was getting more and more frustrated. But I spent money and now it HAD to work. So I started to search for solutions for the J9 crashes.

That was the moment when the following two blog posts came in my way:
Phoneme advanced and eSWT Running Under x86 Windows
Running eRCP with Phoneme Advanced on your mobile phone

This man, apart of writing amazing posts, made me feel stupid for having bought something I didn't want (I deserve it), but also really solved my issues.

From the phoneme I donwloaded the right cab, uploaded it to the juno and installed it.

I then had to change the launcher links of the examples a bit from:

37#"\Program Files\J9\FOUN10\bin\j9.exe" -jcl:foun10 -cp \eRCP\startup.jar org.eclipse.core.launcher.Main -application org.eclipse.ercp.eworkbench.eWorkbench -console

to:

37#"\Programmi\pMEA FP\bin\cvm.exe" -Djava.specification.name="J2ME Foundation Specification" -cp \eRCP\startup.jar org.eclipse.core.launcher.Main -application org.eclipse.ercp.eworkbench.eWorkbench -consoleLog

And it finally worked!! Being an RCP developer for the uDig project I really love the eRCP approach. Now I just have to understand how to take pictures in windows mobile from eRCP and then I am really happy.

I hope this can help someone else to don't lose maoney and time in trying just to make some demo code run.
Post a Comment