Hustle Play

Syd's blog.

Writing a PIM application that works on a real J2ME device

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:

  1. Write the application
  2. Test the application in an emulator. Once you are satisfied, you are ready to run the program on a real device.
  3. Set the correct permissions for your Application. Using EclipseMTJ, you will have to modify the plugin to enable the PIM-related permissions (see below)
  4. 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’).
  5. Sign your JAD and JAR files. (Geotrust)
  6. Upload the JAD and JAR files to a webserver
  7. Create a simple HTML page with a link to your JAD file
  8. Send the URL of your simple HTML page to your phone via SMS
  9. Use your phone to go to the URL
  10. Download and Install the Application
  11. Run the Application

Modifying the EclipseMTJ plugin to allow for PIM (JSR75) permissions

  1. Exit Eclipse if you haven’t already done so.
  2. Navigate to your Eclipse installation’s ‘plugin’ directory (…/eclipse/plugins/)
  3. 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.
  4. Open up the Eclipse MTJ Core JAR. I used 7-Zip to do this.
  5. Edit the ‘plugin.xml’ file using a text exitor. I used Notepad++.
    1. 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>

    2. Replace it with the following code
    3.  <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>
      
      

  6. Navigate to your Eclipse installation’s ‘configuration’ directory (…/eclipse/configuration/).
  7. Navigate into the ‘org.eclipse.core.runtime’ directory.
  8. Delete the ‘.mainData.X’ file (where X is a number).
  9. Restart Eclipse

Reference(s):

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.