Running eRCP with Phoneme Advanced on your mobile phone
Originally, I don't think this is a problem. Because I have run the eRCP with J9 VM successfullly 4 years ago. However, when I revisit this topic recently, I found that this thought was not true. You google some posts about this problem, like here or here recently, or old post here at 2007.
Now the status of JVM on mobile phone is that J9 CDC VM is not available to non-linux platform mobile users for free any more.(maybe binded with some IBM products like IBM JRE6? If I am not right, you correct me^_^). And some benchmark show that the phoneme advanced is faster thant the J9 embed.
Now, I think I should fix this problem for our community. I take out my old HP 1940, and try to find some clues. And yes, I get the crash as well. One convenient thing for Equinox(or other OSGI RI) is that you can find some logs at the %eRCP_ROOT%/configuration/ directory. I find one thing like,
org.osgi.framework.BundleException: The bundle could not be resolved. Reason: Missing Constraint: Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,J2SE-1.3
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(Unknown Source)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(Unknown Source)
at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Unknown Source)
Yeah, "Missing Constraint: Bundle-RequiredExecutionEnvironment" error. So, we know that the Equinox OSGI framework can not recognize the phoneme advanced execution environment. After quickly sourcing, the best fixing solution appears. Using the follow .ink file to lanuch the eRCP,
37#"\phoneme\bin\cvm.exe" -Djava.specification.name="J2ME Foundation Specification" -cp \eRCP\startup.jar org.eclipse.core.launcher.Main -application org.eclipse.ercp.swt.demo.eSWTDemoApp -console
The reason is that the Equinox osgi use "java.specification.name" property to recognize the cdc execution environment, and they just accept the "J2ME Foundation Specification" as the value of property java.specification.name. However, in the Phoneme Advanced, this value is set to the "Foundation Profile Specification" in default. There are many ways to fix this problem, such as modifying the makefile of phoneme, modifying the config.ini to include this property, or modifying the source of osgi. However, the best way now is as my suggestion. I will open a bug to Equinox to see if they want to do something:)
Now you will see the exciting screen on your mobile phone.
The feeling of eRCP has still been awesome from my last try several years ago. The fact eRCP can run on mobile has demonstrated the success of Eclipse RT project. (Surely, OSGi Minimum Execution Environment is JavaME Foundation).
One interesting for me is that the eSWT widgets can work with Phoneme Advanced without any modification. As I have pointed out at the previous post, the JNI application should be compiled with CVM's JNI headers. In win32/x86 platform, this re-compilation is a "must". However, direct eSWT supporting for CVM is not perfect. The screenshots, like "eRCP eWorkbench", has shown some appended unreadable characters on the menu item. That is a eSWT bug (seemly just for CVM) as I mentioned at the previous post as well. It needs times to fix this problem. Stay tuned...
Let's do a summary as follows:
1. full eRCP can be run with Phoneme Advanced
2. full OSGI 4.x RI can be run with Phoneme Advanced
3. if you run the native(JNI) codes and meet some errors, please do not forget to re-compile your JNI codes against CVM's JNI headers.