Hustle Play
Syd's blog.
Writing a PIM application that works on a real J2ME device
Posted by on February 1, 2011
There are tons of search listings that pop up when one searches for ‘J2ME’ and ‘PIM’, but I have not yet found one that details how to run the application on an actual, real, physical, holding-it-in-my-hands J2ME device.
So this post will detail how to do this.
Here are the steps:
- Write the application
- Test the application in an emulator. Once you are satisfied, you are ready to run the program on a real device.
- Set the correct permissions for your Application. Using EclipseMTJ, you will have to modify the plugin to enable the PIM-related permissions (see below)
- Use your IDE to create the package. You should get a JAD and JAR file (XXXX.jad and XXXX.jar, assuming your application’s name is ‘XXXX’).
- Sign your JAD and JAR files. (Geotrust)
- Upload the JAD and JAR files to a webserver
- Create a simple HTML page with a link to your JAD file
- Send the URL of your simple HTML page to your phone via SMS
- Use your phone to go to the URL
- Download and Install the Application
- Run the Application
Modifying the EclipseMTJ plugin to allow for PIM (JSR75) permissions
- Exit Eclipse if you haven’t already done so.
- Navigate to your Eclipse installation’s ‘plugin’ directory (…/eclipse/plugins/)
- Locate the Eclipse MTJ Core JAR file (ex. org.eclipse.mtj.core_1.2.1.v201009031435.jar). Note that your version number may be different.
- Open up the Eclipse MTJ Core JAR. I used 7-Zip to do this.
- Edit the ‘plugin.xml’ file using a text exitor. I used Notepad++.
- Locate the following code
<extension id="jsr75permissions" point="org.eclipse.mtj.core.securitypermission"> <class name="javax.microedition.io.file.FileConnection"> <permission name="javax.microedition.io.Connector.file.write"> </permission> <permission name="javax.microedition.io.Connector.file.read"> </permission> </class> </extension> - Replace it with the following code
- Navigate to your Eclipse installation’s ‘configuration’ directory (…/eclipse/configuration/).
- Navigate into the ‘org.eclipse.core.runtime’ directory.
- Delete the ‘.mainData.X’ file (where X is a number).
- Restart Eclipse
<extension
id="jsr75permissions"
point="org.eclipse.mtj.core.securitypermission">
<class
name="javax.microedition.io.file.FileConnection">
<permission
name="javax.microedition.io.Connector.file.write">
</permission>
<permission
name="javax.microedition.io.Connector.file.read">
</permission>
</class>
<class
name="javax.microedition.pim">
<permission
name="javax.microedition.pim.ContactList.read">
</permission>
<permission
name="javax.microedition.pim.ContactList.write">
</permission>
<permission
name="javax.microedition.pim.EventList.read">
</permission>
<permission
name="javax.microedition.pim.EventList.write">
</permission>
<permission
name="javax.microedition.pim.ToDoList.read">
</permission>
<permission
name="javax.microedition.pim.ToDoList.write">
</permission>
</class>
</extension>
Reference(s):
- Eclipse Community Forums: javax.microedition.pim.ContactList.read lack
- Develop mobile apps with Personal Information Management
- Can I Access Native Contact List from J2ME Application
Advertisement