title.
 
 
Home -- > Notes Index -- > Note   

Lurker's Guide to Running PersonalJava on WinCE (2002-7-26)
Author: US101
Email: cityfan86@yahoo.com

PersonalJava is the immediate predecessor of the Personal Profile of Java ME (J2ME). Note that the Personal Profile is at the Proposed Final Draft stage at the JCP at the time of this writing.

I have been programming in Java for over a year, so when I got a brand new iPAQ I was thrilled. For once I could see if Java lived up to its "Write Once, Run Anywhere" motto. I immediately installed Insignia's Java Runtime Library called Jeode that came on the iPAQ CD. I moved over one of my small Java programs I had written a while ago and to my despair it failed the first time. And the second time, and of course the third time. After a while, I began to doubt why I had bothered to learn Java in the first place.

I looked over the Java forums and immediately came across a post that explained why. I had over looked the fact that I was no longer running J2SE 1.4.1 on a 1.3GHZ machine and 256MB of memory. I was now running on a 200MHZ machine with Java 1.1.8. No advanced features came with this early version of Java, and absolutely no Swing packages.

I searched for days on end picking up bits of info. I read about Java ME (J2ME), Jeode and Personal Java. No one though explained what was the difference. I went to my local bookstore and read about Java ME (J2ME). It looked confusing. I was expecting to see the same classes as J2SE, but sadly I was wrong. Then I saw a mention of Personal Java. I read more on it, and found that it would suit my needs.

I now had all the info I needed, and I am going to share it with you. First off I needed to understand how to write the program. I could have used Java 1.4.1 to write it, but it would have been difficult not knowing what would run in 1.1.8, which is what Personal Java is based upon. So, I ran over the java website and downloaded the correct version of the SDK. Then I saw a post on getting Swing to work with 1.1.8. After a few adjustments, I had my first GUI application ready to be run on my iPAQ. Due to the fact that Jeode came on my iPAQ CD, I chose to use that instead of the Personal Java Runtimes (Jeode is built upon Personal Java). I moved over the class file and the Swing Package, and it worked first time. I was one happy programmer.

Here are the steps to getting Java on your Windows CE Device.

If you wish to use the Personal Java Runtimes then you will need to get the early access version (This is the only version of Personal Java if you have a StrongARM processor). Follow the setup procedure and you will then have the runtimes on your device.

Next, if you want to use Swing then you will need to also download the JFC package. NOTE: This package is about 2.5MB. You must have enough space on your mobile device to store this.

Due to Swing being run under 1.1.8, there is a bug that needs to be fixed. Follow the procedure below to fix this bug..

  1. In the Swing package you downloaded, there will be a src.zip file. Unzip it.

  2. In the Javax\Swing subdirectory there will be a SwingUtilities.java file.

  3. Go to line 677 of that class: Method m = Class.class.getMethod("getProtectionDomain", null);

  4. Replace that line with: Method m = Class.class.getMethod("getPackage", null);

  5. Save and compile the file.

  6. Move the Swingall.jar file from the main download directory to the main directory of the extracted zip file. It should be where the Javax directory is.

  7. Open up the command prompt and goto that directory.

  8. Enter: jar uvf swingall.jar javax\swing\SwingUtilities.class


That's all there is to fixing the bug. Swingall.jar can now be moved to your mobile device.

Depending on if you have Personal Java or Jeode, there will be different ways of specifying the classpath when you run this program. You will have to specify the Swingall.jar file.

So, that's all there is to making Java run on a Windows CE device.

Here is a quick overview:

  1. Download and install Jeode or Personal Java.

  2. Download and install the JDK 1.1.8.

  3. Download and fix bug in Swing package.

  4. Write the program and compile.

  5. Move program and swing package to mobile device.

  6. Specify the Swingall.jar file in the classpath.

  7. Run.


Here are some links to websites which will be of help to you:

Personal Java for Windows CE - http://developer.java.sun.com/developer/earlyAccess/personaljava/

Swing Package - http://java.sun.com/products/jfc/download.archive.html

JDK 1.1.8 - http://java.sun.com/j2se/downloads.html

return to previous page.

pixel
Home | Java ME (J2ME) Notes | Java ME (J2ME) Resources | Contact Us
pixel
Copyright © 2006 RimLife Technologies LLC
All Rights Reserved. Java, Java ME (J2ME), are the trademarks of Sun Microsystems Inc.
Legal Stuff