So the Midlet text adventure idea I had yesterday got me going on J2ME stuff again, which lead me through a bunch of different paths both offline and online in terms of what to do. Since it doesn't look like I'm getting very far with C++ stuff as of yet, this feels like good a place to start developing for my phone. I've had it for a month now and haven't done anything besides play with it, so it's time to get down to business.
Starting with mobile Java is actually exponentially easier. I already have a good base on J2ME since I was playing with it literally a year ago and I'm finding now's a WHOLE different story because I have a great phone to use, which helps me from an incentive angle quite a bit. And I'm realizing that Midlets aren't as hamstrung as I thought they were. I found a great Solitaire game for J2ME which is as good as any native one, and the TipicME IM app is better than the IM+ native app I bought. I'm realizing there's lots of little apps that I want to start developing that all could fit quite well under the MIDP profile.
Midlets still aren't my favorite though because they have to live in the sandbox. And on many phones, getting to a Java Midlet is a process. For example on my Nokia 7650, I have to go into the "Apps." icon to find my midlets (which are called generically "applications" without the word Java mentioned at all which is weird... what are all the native apps called then?) Then once I enter the "Apps app" I find a list of the midlets I have and I can then run one from there. I think my first native Nokia app will be something that simply creates an icon on the main application screen which calls a Java app, so you don't have to go through all that "Apps" nonsense. Once again I ask why Nokia limited themselves so much in their Java implementation.
Along these lines, as I was looking around online, I went to the SonyEricsson website and read a bit about their implementation of Personal Java. It so rocks. It's just what you want if you're a Java developer: no sandbox. And I must say that even though there's a lot less documentation on the SE site, all of it is SUCH a higher quality than on the Nokia site. Nokia has too much marketing involved in their developer area, and sometimes it's a bitch to get any sort of real info out of their multitude of PDFs, which are all locked from copying (including example code. Duh!)
In case you're wondering about developing for the P800/P802 (what's the 802? I don't know... it's in the docs, though. Says it has less memory...), here's some very interesting startup info from their documentation, specifically the Java Development Guidelines:
A minimum configuration (the free route to development) for a PersonalJava developer who wants to target the P800 is:
- The Symbian UIQ SDK (to get hold of essential Symbian PersonalJava documentation and deployment tools)
- The Sun Microsystems Inc. specification of PersonalJava (PJAE). This document describes the subset of a JDK 1.1.* generation class library that is supported by a PersonalJava edition. The P800 PersonalJava runtime environment corresponds to version 1.1.1a
- A copy of the Sun Microsystems Inc ï¿½JDKï¿½ (Java Development Kit). (Do not confuse this with the JRE environment installed part of the UIQ SDK installation, that environment is needed to support running the Symbian tools). If you intend to use the JDK stand-alone to carry out compilation of Java source code from a DOS command shell to be run on P800, you should download and install the JDK 1.1.8_010 which most closely corresponds to the PersonalJava evolution. It has formally passed the ï¿½Sun End of Life processï¿½ but may still be preferred for this usage since it does not offer more advanced Java features and class library than supported by the Symbian Java runtime and thus the chance for code incompatibility is reduced.
- JavaCheck is a useful tool provided by Sun that helps you find out if your source code is conforming to the PersonalJava specification. You should use JavaCheck 3.0 which corresponds to the 1.1.* PJAE specification.
Advanced PersonalJava / native code interaction:
PersonalJava also offers the possibility for advanced third party developers to develop custom Java APIï¿½s that makes use of underlying native UIQ SDK APIï¿½s (or third party newly developed native functionality) through the JNI (Java Native Interface) API. JNI development is supported only with the Metrowerks Codewarrior for SymbianOS IDE editions. Due to the advanced capabilities of a PersonalJava application these needs to be treated security-wise equal to a C++ application. Same as for a native application a PersonalJava application is deployed for end user installation on P800 in Symbian install file format (.SIS). SIS files are generic file installation containers so any combination of native and PersonalJava applications or other content can be deployed in the same SIS file. The SIS file mechanism is documented in the UIQ SDK.
Due to ROM space constraints the P800 java runtime is installed in a secondary 'pseudo ROM' file system where the virtual machine will not execute directly from ROM but instead the VM and all classes become loaded into RAM before execution. This adds an additional one-second-startup time compared to ROM execution but as a slight bonus, execution from RAM is somewhat faster than from ROM once the VM and classes have been loaded.
Very interesting stuff that I didn't know before. IMHO, the P800 is going to be too expensive for general adoption and the memory stick sucks, but beyond that, it's a sweet little phone. If you haven't seen Jï¿½rgen's P800 review, you should check it out. It has all the details.
But that's the P800 and I have the 7650, which means I'm stuck doing Midlet development. Well, I don't care right now about the other phones because I don't have access to them, so I just wanted to know what I needed to know to get started developing in Java for the Series 60 platform. First, if you don't know about J2ME stuff, it's actually very simple, but for some reason there's 30 different names. The two phones really demonstrate the two types of mobile Java development. There's PersonalJava which is basically a JDK 1.1.x implementation and then there's the CLDC/MIDP specification. There are others, but don't worry about them because you're not going to be seeing them much if at all. What the CLDC/MIDP means is that in order to run your Java app, it only has access to a subset of the Java language, an even smaller subset of the APIs, and needs to run in a sandbox as a Midlet, which is just a fancy name for a mobile applet.
So to get started on my phone, I needed to confirm which version the specs I was using: The 7650, according to this page supports CLDC 1.0, MIDP 1.0 and the Nokia UI APIs. The 3650 will also support the Mobile Media API (for better sound/video support) and the SMS API for sending text messages. This is good to know, now when looking at the chaos which is Sun's wireless Java pages, you can focus on the right APIs. But beyond some tutorials and articles, you don't need to download anything from Sun's site. Everything you need to get started can be found from Nokia, all packaged up nicely for development on both Windows and Linux.
Nokia's developer website is pretty much pure anarchy. Nokia's Tools Page has a zillion different SDKs to choose from, all presented by date and category. It sounds organized, but it doesn't feel it. And documentation is just mixed in whenever they feel like it. It's hard to know if you've got everything you could need or if you've got the latest version. Don't let that put you off though. There is some order to the madness on Nokia's site... but just prepare for a good few hours to get through all the licensing crap they throw up in front of you in order to download the littlest thing. Oh, and you need to sign in to get to the files, so be prepared for that also.
Anyways, you need to download two files to start developing for your 7650/3650: Nokia Developer's Suite which has both a simple Java dev environment, the CLDC Java classes, and MIDP documentation. Also you need the Nokia Series 60 MIDP Concept SDK Beta 0.2 which contains the Series 60 emulator, Nokia UI API documentation and sample code. There are also a bunch of PDF tutorials and docs available online as well.
Finally, thanks to Erik who played this game a few weeks back, I can start doing my J2ME development the same way I do my normal J2SE development: with Ant. Check out this article about starting J2ME dev with Ant and this site which has custom J2ME Ant tasks. Very nice.
So that's the scoop. Back to Mobile Java. I must say that I'm pretty excited... it's so fun to see some code you wrote run on your phone (or if you want, your Palm, even if it's just hello world.
P.S. My DSL dropped last night and I couldn't post this until the morning. Urgh!