Java ME

Compiling Java (SE, ME) in PocketPC with PhoneME

Posted on Updated on

As I promised earlier I try to find a free method to compile java sources on PDA including Java SE and Java ME. In my earlier post I succesfully compiled Java SE and ME code with CrE-ME.

How to compile

I’m used precompiled version of PhoneME as a JVM and cke as text editor.

To compile with make some batch file (%1 is the fullname of the source, %2 is the fullpath):

@echo \phoneme\foundation\bin\cvm -cp "\jar\tools.jar;\jar\rt.jar;%2\" %1
@\phoneme\foundation\bin\cvm -cp "\jar\tools.jar;\jar\rt.jar;%2\" %1


@echo \phoneme\foundation\bin\cvm -cp "\jar\tools.jar;\jar\rt.jar;\JAR\midpapi10.jar;\JAR\cldcapi10.jar;%2\" %1
@\phoneme\foundation\bin\cvm -cp "\jar\tools.jar;\jar\rt.jar;\JAR\midpapi10.jar;\JAR\cldcapi10.jar;%2\" %1


You can compile and run your compiled class:

Compile \srcpath\ \srcpath

\phoneme\foundation\bin\cvm \srcpath\hello

It seems to me that running the compiled MIDP is more compilcated, you should install your midlet *.jar first then run with the MIDPLauncher. You can install a midlet within the GUI, but it’s frustrating as you can’t use copy/paste, or this command line installer:


if not %1X == X goto run_midlet
@echo off
echo .
echo Usage: installMidlet ^<URL^> [^<URL label^>]
echo .
goto :EOF

cd \phoneme\midp\bin\arm\runMidlet -1 com.sun.midp.scriptutil.CommandLineInstaller I %1 %2

I believe somehow we can run our classes without jar’ing but how. However it seems to me that you can run your midlet from the command line only if you know it’s position in the MidletLauncher:


cd \phoneme\midp\bin\arm\runMidlet %1

Example: RunMidlet 2 will start the second installed MIDP.

isJavaLetterOrDigit(C) error

You may encounter a serius error while compiling Java ME source code:

java.lang.NoSuchMethodError: java.lang.Character: method isJavaLetterOrDigit(C)Z not found
at Source)

In JavaDocs I found this:

public static boolean isJavaLetterOrDigit(char ch)
Deprecated. Replaced by isJavaIdentifierPart(char).

Determines if the specified character is a “Java” letter or digit, that is, the character is permissible as a non-initial character in an identifier in the Java language.

A character is considered to be a Java letter or digit if and only if it is a letter, a digit, the ASCII dollar sign character '$', or the underscore character '_'.

On this arcticle:

The pages and recommend using the compiler in the J2SE 1.1 classes to compile with For Java 1.3.1 that would be tools.jar, giving you

java -cp tools.jar Unfortunately, that does not work with Java 1.3.1. The J2SE compiler uses Character.isJavaLetterOrDigit, which in J2ME has been replaced by Character.isJavaIdentifierPart. And since Sun does not distribute the java sources of their compiler, we can’t fix it.


Use the Eclipse‘s JDT Compiler named ecj.jar.

@echo \phoneme\foundation\bin\cvm -jar \java\ecj\ecj.jar -cp \jar\midpapi20.jar;\jar\cldcapi11.jar;%2\ %1
@\phoneme\foundation\bin\cvm -jar \java\ecj\ecj.jar -cp \jar\midpapi20.jar;\jar\cldcapi11.jar;%2\  %1

Configuring cke to compile


Program: \Windows\CMD.exe

Arguments: /c “\Compile.bat” “$fullname” \$filepath 1>”$filepath\$filename.log” 2>”$filepath\$filename.err”

[X] Save actual document


Program: \Windows\CMD.exe

Arguments: /c “\ecj.bat” “$fullname” \$filepath 1>”$filepath\$filename.log” 2>”$filepath\$filename.err”

[X] Save actual document


Q: Compiling with ecj.jar will cause an error

cannot read the source from <> either the file uses a different than utf-8 or it is corrupted

A: Use only English characters (avoid á, é, ő, ú, ű, í etc even in commented lines)

Q: How to preverify all the classes? This process is necessary in case of MIDP.

A: I don’t know, maybe Eclipse has a equivalent java bytecode? Update: read this post!

Q: How to make jar and jad file?

A: I don’t know, maybe TotalCommander can zip, add manifest file and rename it. Edit jad manually.

Gluglu on PDA

Posted on Updated on

Gluglu 1.4 running on an i-mate PDA-N with CrE-ME JVMWith CrE-ME installed on my PDA, I’ve managed to play my cellphone game, Gluglu. I’ve tried also my unfinished games: Pusztulat and Bee.
What a pity, that CrE-ME’s evaluation time expires within 30 days. I try to find the best JVM + compiler combo, to develop Java ME games on my PDA.
I’ve already found an IDE named IpaqIDE (can compile, but Run button not working), and an another named FLM Javac wrapper (Run button give strange errors).

There are some possibilities to compile and run your project.

Using CKE as IDE

I’m using and recommend CKE for write the source code, and I made some .bat file to compile and run easily.

Steps I followed to make this available:

  1. Installed all the necessary files, to use the cmd.exe properly
  2. Installed CrE-ME (with Java ME support)
  3. Using this directives I installed to my desktop PC the JDK 1.3.1_15 and copied the following files to my SD card (\Storage Card\jar\): c:\jdk1.3.1_15\jre\lib\rt.jar and c:\jdk1.3.1_15\lib\tools.jar
  4. installed CKE
  5. made some batch file (see below)
  6. configured CKE to use this batchfile

Note: Steps 1-3 is necessary if you want to work with IpaqIDE.jar, and only steps 1-2 neccesary if you want to work with FLM Javac Wrapper (javacw.jar) but in javacw.jar source editor not included.

Batch files I created:


“\Windows\CreME\bin\creme.exe” -Ob -classpath ‘\storage card\jar\tools.jar;\storage card\jar\rt.jar;%2’ %1


“\Windows\CreME\bin\creme.exe” -classpath %2 %1

I added two new command to CKE:

Java Compile

Program: \Windows\CMD.exe

Arguments: /c “\JavaCompile.bat” “$fullname” \$filepath

[X] Save actual document

Java Start

Program: \Windows\CMD.exe

Arguments: /c “\JavaStart.bat” $filename ‘\$filepath’

[ ] Save actual document

Or you can use one of the two IDE if you want


To start ipaqide.jar you should create a batch file:

“\Windows\CrEme\bin\CrEME.exe” -Ob -classpath ‘\ipaqide.jar;\storage card\jar\tools.jar;\storage card\jar\rt.jar’ ipaqide.Javacw2

Please keep in mind, that the RUN button do nothing. You should read the manual on the homepage.

It’s a complete IDE, you can add files, edit and compile them. The Run command do nothing. You cannot save your project and the source editor doesn’t support syntax highlighting. It is using the rt.jar and tools.jar you copied from desktop PC.

FLM Javac Wrapper

Easy to start, as you can double click on the javacw.jar and the IDE start. It isn’t a full ide as source editor not included. You can add files to the project, save/load project, compile and run. Unfortunately the RUN command isn’t working for me. javacw.jar contains all the necessary files to compile a .java file, so no need to copy manually the rt.jar and tools.jar from your desktop PC, also you can download the wrapper.jar without this files if you want.


CrE-ME’s installer copies manual documents to your PDA in .html format (\Windows\CrEme\Documentation).

If you want to run a .jar file, then just double click on it. If the manifest file is containing the main class then Creme start it automatically, otherwise you should write a batch file like this:

“\Windows\CrEme\bin\CrEME.exe” -Ob -classpath ‘\ipaqide.jar’ ipaqide.Javacw2

where -Ob means output directed to the Creme console. You can use -Of to create \jscpout.txt,

and ipaqide.javac is the main class

To start a Java ME program you should create a batch file like this:

“\Windows\CrEme\bin\CrEME.exe” -Of -mv -classpath ‘\my documents\Gluglu1_4.jar’ Gluglu

where -mv mean it is a Java ME program (default is Java SE applet).

But these batch files aren’t working for me. I have to copy paste this command to my console. I don’t know why, if you know a workaround please let me know. Maybe the ‘my documents’ is unreachable?

Compiling Java ME

To compile Java ME source, install to your desktop PC the Sun Wireless Toolkit 2.5.2 (this is the oldest what you can download from Sun homepage without registration required). Copy the following files to SD card (\Storage Card\jar\): C:\WTK2.5.2\lib\ cldcapi*.jar and C:\WTK2.5.2\lib\ midpapo*.jar.

I’ve created Batch scripts for compile and start:


“\Windows\CreME\bin\creme.exe” -Ob -classpath ‘\storage card\jar\tools.jar;\storage card\jar\rt.jar;\Storage Card\JAR\midpapi10.jar;\Storage Card\JAR\cldcapi10.jar;%2’ %1


“\Windows\CreME\bin\creme.exe” -mv -classpath %2 %1

(%1 is $filename and %2 is \$filepath in CKE)

I’ve used this HelloMIDlet source to test the compiler:

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

public class HelloMIDlet
extends MIDlet
implements CommandListener {
private Form mMainForm;

public HelloMIDlet() {
mMainForm = new Form(“HelloMIDlet”);
mMainForm.append(new StringItem(null, “Hello, MIDP!”));
mMainForm.addCommand(new Command(“Exit”, Command.EXIT, 0));

public void startApp() {

public void pauseApp() {}

public void destroyApp(boolean unconditional) {}

public void commandAction(Command c, Displayable s) {

Google for Gluglu

Posted on Updated on

I’ve just searched the Internet for my game: Gluglu.

The result is quite interesting as I got a lot of russian webpage as a result. There are some example:

Other sites:
Motoroal C385
Interesting for me seeing IRC archives and forums where members say ‘My favorite is Sudoku, Gluglu and Sokojava’.

New projects added

Posted on Updated on

Xmas was my first game what I finished. Originally I wrote it in Turbo Pascal, and it used 80×25 text screen mode with ASCII characters, it was controlable with the cursor keys. Then the Xmas II used 320×200 256 color screen mode, nice graphics, sound, and it was usable with mouse. Later I ported it to mobile phone, using MidletPascal. And recently I ported to Pocket PC (WinCE) using OpenGL ES, compiling with pgcc, what allowed me to write and compile the source on my PocketPC directly without any desktop computer needed.

Pusztulat was my second program in Java ME for mobile phones (first was Gluglu). It’s still in WIP state. Pusztulat is a Overworld Zero clone which is an Ultima Underworld parody found as a minigame in the game System Shock II.

I’ve just started Monolings which is a game for a competition. I uploaded a concept art.

Some files uploaded

Posted on Updated on

I uploaded some of my projects: Gluglu and Easter Quest.