Home > 3. MacOS, Applications, Programming on MacOS > Set up environment to develop J2ME MIDP 2.0 apps in MacOS X

Set up environment to develop J2ME MIDP 2.0 apps in MacOS X

(Click vào đây để đọc bằng tiếng Việt)

I have got my MacBook 467 for 2 months, and after a while of playing with it, I want to do something meaningfully… In one of the first things, I set up environment for J2ME development on MacOS X…

I google around… and around…, read some tutorials, and maybe this is one of the most useful instruction. But it still doesn’t work for my case, so I had to modify some arguments to make it work. We’ll take a look on what did i do.

My platform:

– MacOS X 10.5.6

– Xcode 3.0

There are some changes Apple made for Xcode 3.0 and MacOS X Leopard, so it’s important to identify exactly their version on your Mac.

So here we go. There are some ways to set up J2ME environment by using Xcode, Eclipse, Netbeans… We’ll consequently consider all of them.

1. Using Xcode:

Although there’re some people complain about Xcode’s configuration complexity, but I think Xcode is a really powerful IDE on Mac, so I start playing with it.

Installation

  • Download MPowerPlayer. This is maybe the best (and only) SDK supporting J2ME development on MacOS. It provides an emulator and others tools you need when developing MIDP applications.
  • Create folder /Developer/Java
  • Put the mpp-sdk folder into /Developer/Java/ (or you can put it anywhere you like, and create an symbolic link to it in /Developer/Java/. (This will help the ant build file to find the SDK).
  • Navigate to/Developer/Java/mpp-sdk/osx/xcode/template/. Extract file xcodetemplate.zip. Put the Ant-based MIDlet jar folder into /Developer/Library/Xcode/Project Templates/Java/. This is the project template for Xcode to create new J2ME project.
  • Open /Developer/Library/Xcode/Project Templates/Java/Ant-based MIDlet jar/build.xml file by TextEdit or DashCode. Modify some argument:
  1. On the 14th and 15th lines, make sure you have the right path to the mpp-sdk:

    <!-- Edit the "mpp" property with the path to your installed mpp-sdk. -->
    <property name="mpp" value="/Developer/Java/mpp-sdk"/>
  2. On the 20th line,  make sure you have the right path for classes.jar of the JavaVM on MacOS, like this:

    <property name="java.classes.jar" value="/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Classes/classes.jar" />

Although there’s Java VM 1.5.0 on my Mac, but i have to use 1.4.2 version because it’ll cause the famous “”Error preverifying class” error if I use the newer version. Somewhat stupidly!

  • Navigate to /Developer/Library/Xcode/Project Templates/Java/Ant-based MIDlet jar/ in Finder. Right click on RunJar.xcode > Show package content. Open project.pbxproj file with TextEdit. Find the line buildToolPath = /Developer/Java/Ant/bin/ant; and replace it with buildToolPath = /usr/bin/ant;. Save the file. Since MacOS Leopard included Ant, so we don’t need to install Ant with Xcode anymore.
  • That so.

How to use it

Select “File → New Project” and then choose “Ant-based MIDlet JAR” from the list of templates. You will have a project that you can build and run in the emulator to start from.

Press Build and Go, you should get this:

Xcode and the j2ME MIDP emulator

Xcode and the j2ME MIDP emulator

2. Using Eclipse

… tobe contined…

3. Using NetBeans Mobility Pack

I haven’t tried this one myself.
Here is a small HOWTO on how to accomplish it.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: