Javac on EPOC
 
 *
Compiling Java on EPOC Release 5

Last updates:

 *
PSION ships a Java Runtime Environment (JRE) for EPOC with their PSION Series 5mx (PRO). As for all JREs it does not include a Java compiler. So you are able to run Java applications/applets, but you won't be able to develop "on the road".

But as the Java compiler provided with SUN's JDK is itself written in Java, there is no reason why not to install this feature on your favourite PDA.

This page provides you with the easy steps necessary to teach your EPOC on how to compile Java from the source.

Here we go:

 *

Grab the EPOC Java SDK with it's emulator (it's free!) (note from 2011: good luck with that!)
or
go get the PSION Series 5mx (PRO)
or
go get the Ericsson MC218

If you got the real device make sure to have the JRE installed, supplied to you on the CD (Series 5 MX) or CF-Card (Serie 5 MX PRO) that came with your PDA.

If you own an Ericsson MC218 you can find the JRE on Ericssons mobile internet pages at http://mobileinternet.ericsson.se/. You must sign up there first. Please note that you must have a contract with a moblie phone operator to be eligible to sign in.... Click on "Products" then "Ericsson Software", select "MC 218". Scroll down and you will find a link to the Java Virtual Machine. You have exactly 3 tries to perform the download. Doesn't that make you feel like a valued costumer?

 *

Get the JDK 1.1 for your desktop computers OS and install it.
As the Java compiler is pure Java, we will now rip it out of the JDK and use it on our EPOC device :)

The JRE for EPOC is based on Version 1.1.4 including some additional fixes; currently available from SUN is 1.1.8. I used 1.1.8 and it worked fine. If you encounter compile problems consider getting a Linux 1.1.x Version from http://www.blackdown.org/.

Create a directory called "c:\classes" on your EPOC device. On the emulator that would be D:\epoc32\Wins\C\classes where D: is the drive letter of the SDK installation.

 *
Locate the file lib\classes.zip in the installation directory of the JDK on your desktop computer
Open it with winzip or your favourite ZIP tool
 *
Extract all files stored under

    sun/tools/asm/*.class
    sun/tools/java/*.class
    sun/tools/javac/*.class
    sun/tools/javac/resources/javac.properties
    sun/tools/tree/*.class

to an empty folder on your PC; e.g. c:\tmp\javac
Using WINZIP you can sort the zip's files by pathname by clicking on 'Path' on the list box header.

Pack the extracted files into a zip file again (using winzip you can do this by rightclicking the javac folder and selecting "Add to javac.zip".

Make sure you didn't strip the directory information or garble the filena~1 of the unzipped files.

Rename the new zipfile to javac.jar and copy it to c:System\Java\ext\ on your device. With zip's compression turned on this file is 316k on my machine.

Symbian has made some optimizations to their java implementation on the device. This included putting some classes into the VM itself. The compiler can't find these classes, we therefor need a copy of the original classes as well. These classes are

 *

java/awt/*.class
java/io/*.class
java/lang/*.class
java/net/*.class
java/security/*.class
java/text/*.class
java/util/*.class

Note that this is a simplified list; if you want to save a few bytes stick to the the actual list of missing classes.

You'll most probaly not need the sun/* classes, as they may not be accessed directly in 100% pure Java programs - they are therefor not needed by the compiler.

Perform the same steps with these missing classes as with the javac classes. Put them in a zip file called missing.jar and place it in c:\classes\lib\ on your PSION.
Even if you don't like the name 'missing.jar' don't change it. :) The file is 742k on my machine - your values might differ slightly.

 *

You need a litte wrapper application so you can do without a commandline. It will also modify the CLASSPATH so 'missing.jar' can be found by the compiler. Additionally it will prevent the VM from quitting after compilation. As the VM doesn't need to start again with every compile run, this will greatly increase perfomance. Download the wrapper and unpack it to C:classes.
You might also want to take a look at the source.

The console is disabled by default on the real machine (not on the emulator). It can be activated by creating a file (of any type) called console in a folder called ?:\system\java\. You might want to do this before using the compiler.

 
 *
Write a little test source - this is a very popular one.

Go to folder C:classes on your EPOC
Open the compiler wrapper by clicking on Javac.class

 *
Enter the filename of your Java sourcefile (omit the path unless your playing with "packages")
Click Ok
The program will now (hopefully) compile.
Note that a new .class file has been created in c:\classes
 *
Run your App by clicking the .class file.
 *

Enjoy! :)

If you are looking for a text editor to use on your EPOC device, you might want to check out http://pda.dk/pdalt/pdajava/je5/. You'll find java editor there, that can make use of this pages javacwrapper as a plug-in.

 *

Questions and comments are welcome.

Frank Bodmann - fbo (at) hasiland . com
   
 *

Revision History

February 18, 2011

    Clean up

March 23, 2000

    Added lots of links to amazon.com for your shopping delight ;-)

    Updated the information on how to get the JRE for the MC218

November 15, 1999

    Added information regarding Java on Ericsson MC218 and a 'compatible' editor

October 14, 1999

    Converted the page layout to the new hasiland design
July 15, 1999
    Uploaded a new version of javacwrapper (for the second time today).
    Compiler does not quit after compilation now, resulting in up to 50% performance increase in subsequent compilations.
July 15, 1999
    Updated the instructions to work with the device; uploaded new version of javacwrapper
July 12, 1999
    Even greater news (for me that is)!
    I got my Series 5mx PRO this monday - ordered it last friday; well done MobiTec and Deutsche Post AG :)
July 08 1999
    Great news! John Davies made it and found, what you won't find on this page: This missing classes. In other words: This document is currently outdated but will be updated shortly to reflect the new findings. For now you should jump over to http://www.davies.lu/Java/ to make it happen: compile java on the Series 5mx / Serie 5mx pro
July 03 1999
    This guide only works for the emulator. I still don't have the device, but I was informed that the compiler does start to run, but creates a compile error "Superclass java.lang.Object of class ... not found"