[p900] Sun Java and J2ME for the P900

  • From: Alfonso Martone <a.martone@xxxxxxxxxxx>
  • To: p900@xxxxxxxxxxxxx
  • Date: Sat, 21 Feb 2004 10:20:23 +0100

While the UIQ 2.1 SDK comes with Java facilities, I prefer using
native Linux programs (note: I don't like Java; I wrote these
notes only because I happened to do some tests; I don't think
I will write any extra news about it). Anyways, it's an
interesting thing to have for it an emulator/debugger running
under Linux.

First, install the Sun Java 2 package for Linux; I found it in
the SuSE 9 packages, it's the "java2" rpm, version 1.4.2.

Then, fetch from the Sun site the free J2ME package found here:
http://java.sun.com/developer/releases/j2mewtoolkit/

(you have to download an 8Mb file and install it. This is quite
easy: once downloaded, you will get a file named something like
j2me_wireless_toolkit-1_0_4_01-bin-linuxi386.bin

Make it executable and start it:
chmod 755 j2me*
./j2me*

Answer "yes" to the license agreement, and be sure to specify the
Java path (maybe the default one is not correct). I had to specify
/usr/lib/SunJava2-1.4.2/bin/ (which is the path set up by SuSE
Java 2 package installation).

I chose to install the J2ME stuff in my home directory
(/home/alfmar/.j2me). Once completed, I started the J2ME wireless
toolkit bar (which I found in /home/alfmar/.j2me/bin/ktoolbar),
then loaded one of the example projects ("Games") and then press
the "Run" button. Great: the J2ME emulator runs correctly in a
Linux window! (you can select some different phone templates for
the emulated j2me phone: gray, color, minimum, etc).

Now I beamed the games.jar J2ME package to the P900 (actually it's
a zip extractable archive, but the .jar extension makes the P900
understand it's a Java ARchive); I used obex_p900 to beam it:
obex_p900 /home/alfmar/.j2me/apps/games/bin/games.jar

It was correctly installed on the P900 (remember that the P900 is
J2ME-enabled and MIDP-2.0 compliant, not only MIDP-1.0): in the 
Application Launcher I found three new items (PushPuzzle,
TilePuzzle, WormGame). Clicking on WormGame I saw for a short time
the "JavaPowered" banner, then the game started. The "console"
below the game is not that nice, so I chose to hide it.

To uninstall these three games, simply uninstall the "SunSamples
Games" package.

I found the sources of the WormGame (*.java files) in the
/home/alfmar/.j2me/apps/games/src/example/wormgame directory.

I would not prefer the Java to develop P900 programs because it's
an interpreted language (thus much slower than a C++ equivalent).
I don't care about "portability", because only the P800 and a few
other UIQ-based devices have a decently-sized color screen, and I
do not want to write applications which must care of different
screen sizes and features. J2ME, in my opinion, is good only for
a few "lightweight" applications, and its support on P900 is only
for commercial reasons.

**


Other related posts:

  • » [p900] Sun Java and J2ME for the P900