Ah Java – a once massively hyped future-of-the-web-technology, now a ubiquitous, its-everywhere-but-you-never-see-it kind of thing. Everything these days seems to be ‘Java-enabled’ – in fact, if you have a device that seems to have at least some computational ability, you no doubt simply assume that it has Java, and don’t even bother to look.
That’s certainly the case with mobile phones. If you look at the long list of features of the new mobile phones, you’ll probably not even bother looking at whether it’s Java-enabled or not, in the same way you never bother to look whether it’s SMS-enabled – you’ll just assume that it is. But it wasn’t always thus. I remember back in the heady days of 2001, attending an Orange Wireless Developer’s seminar, when the talk was on how “every new mobile would have Java installed by Christmas 2001”, which would be a major advance for mobile phones. And it was – but do you ever use it? Really? Apart from the preinstalled Java apps? Be honest now! Do you want find out how to use it?…
So now we have the situation where everyone has Java on their phones, but very few people actually make any real use of it. This HowTo should solve that by telling you how ridiculously easy Java midlets are to install, and how to make the most out of the Java features on your phone.
Hugely Brief Introduction to Java J2ME
Java is an object-oriented programming language developed by Sun Microsystems that can trace its roots back to 1990. You can read more about its origins at Wikipedia and Sun’s Java.com web site. What’s important to us is that the key Java platform (i.e. all the libraries that were normaly associated with it) split into three in 1999, with the development of an Enterprise-level superset of the key Java platform (J2EE); a rebranding of the original platform (J2SE); and the development of a cut-down version designed specifically for small mobile devices – J2ME.
J2ME is the edition on all current mobile phones. Some device manufacturers may add their own extensions, but a nice ‘generic J2ME midlet’ should work on all devices (note the emphasis on ‘should’!).
Traditionally, Java downloadable packages have been called applets. For J2ME, however, these downloadable packages are referred to as midlets, as they are written for the Mobile Information Device Profile – or MIDP – which is specifically designed for the constraints of a mobile phone. So, when you download ‘Java’, you’re downloading a Java midlet.
It’s the midlets that contain the Java code that make the thing you downloaded actually do something. The great thing about Java is that you really don’t need to know anything about how it all works in order to use it. All the code that’s part of a midlet is contained in something called a JAR file (short for Java ARchive file, and identified by its file extension .jar), which is basically just a zip file that keeps all the files and classes specific to that midlet together. This means you need only worry about one file – the .jar file – irrespective of how complex the code contained within that file’s classes is. It’s the .jar file that you download onto your PC, upload onto your phone from your PC, or transfer onto your phone over the air via WAP.
Installing a midlet onto your phone
Right, onto the crux of this Howto: how to actually install a midlet onto your mobile phone. As has been said, there are two different ways of doing this:
- Download from the web onto your PC, then upload onto your phone
- Install directly Over The Air (OTA) via WAP
You may not have a choice how to do this: some content requires you to
Installing your midlet via the web and your PC
Installing your midlet via the web requires two stages: firstly, download a .jar file from the web onto your PC. Secondly, upload the midlet onto you mobile phone.
The first stage is simplicity itself. Once you’ve found the .jar file, just download it somewhere onto your PC. It’s usually free to do this, although there are ways of getting you to pay (e.g. by using a PayPal account before you can download it, or by requiring you to register the midlet via your mobile phone before you can use it).
The second stage will depend on the mobile phone device you have, and the way in which you transfer files from your PC to your phone. There are several options to do this:
- Explicit physical connection via USB cable
- Direct InfraRed (IR) connection
- Direct Bluetooth connection
The first option obviously requires a USB cable, which will normally be provided by your phone manufacturer, and will come with the phone itself, together with some software. See your phone’s manual (or your phone manufacturer’s web site if you’ve lost it!).
The other options are slightly more complex…but only slightly, so don’t run away just yet!
Uploading your midlet via an InfraRed (IR) connection
If your phone and your PC both have InfraRed (usually your phone will have, but your PC won’t unless it’s a laptop), you can transfer files via InfraRed. This is actually quite simple if you use Microsoft XP, and you can find details on establishing a connection either on your PC’s help file, or at Microsoft’s web site.
Once the connection is established, you can send files to your mobile phone easily. Simply line up your mobile phone with your laptop’s IR receiver, and your laptop should suddenly come alive and tell you “another computer is within range” (see image, above). Click the pop-up balloon, and a window will open asking you what file you’d like to transfer. Locate your midlet (the .jar file you downloaded), click on it, click ‘Send’ and the file will be sent! Once successfully uploaded, your phone will usually ask you what you want to do with it. Normally it will give you an option to save it in a specific location (usually a folder name). Choose an appropriate location, and it will be saved. To use it, just select it from your phone’s menu, and it will be run by your phone’s J2ME implementation. See – told you it was easy!
Advantages of IR File Transfer
The advantage of IR upload is that virtually all mobile phones and all laptops have IR ports already installed. Make sure you attempt this first when your laptop’s connected to the web, however, as your laptop’s version of XP may need to download some extra drivers specific to your phone for optimum file transfers. This is all done for you by XP as a standard Windows update, though, so there’s nothing for you to worry about.
Disadvantages of IR File Transfer
The main disadvantages of IR file transfer are that your PC needs an IR port, and usually desktops don’t have them; and the file transfer only runs at 9.6Kbps, which is slow, particularly for large files. Then again, though, midlets tend to be <100KB, so this may not be too much of a problem. A much better solution, though, is the increasingly ubiquitous Bluetooth option.
Uploading your midlet via Bluetooth
Bluetooth is a technology for implementing wireless Personal Area Networks (PANs) – or, in other words, for establishing a wireless radio connection between small devices such as mobile phones, laptops, cameras, printers, etc. over a short area (hence ‘Personal’ in the term PAN). Famously named after a 10th Century Danish King, Harald I (a.k.a. Harold Bluetooth, presumably due to an aversion to the dentist), the technology can trace its origins all the way back to 1999, and has since become ubiquitous amongst most mobile phones. However, Bluetooth gadgets have been less successful, and for a long time, nobody seemed to know what to do with the technology, other than develop those ridiculous Bluetooth headsets.
However, Bluetooth is primarily concerned with connections, and of course you can only connect two devices via Bluetooth if both devices support it. Accordingly, Bluetooth-enabled mobile phones are only of any use if there’s another Bluetooth-enabled gadget to connect to. For a long time, there wasn’t, so Bluetooth truly was pointless for anything other than direct mobile-mobile or mobile-strange-earpiece communication. Today, however, the situation has changed, and there are now many Bluetooth-enabled devices, from printers, to laptops, to PCs, to er, little remote-controlled cars (glorious idea, Sony Ericsson!). Indeed, you can even control your PC with your mobile phone via Bluetooth, should you think that your keypad is a more effective means of moving your mouse cursor than your mouse (who thinks of these things?!)
Establishing a Bluetooth Connection
OK, background over with, how do you use Bluetooth to exchange files? Well, firstly, you must establish a connection between Bluetooth devices – in this case, between your mobile phone and PC. However, although most laptops these days come with Bluetooth pre-installed (certainly most of the wireless Centrino-based ones do), desktop PCs usually do not. You can remedy this by buying a USB Bluetooth adapter (see left), which is a simple USB pen-drive-style dongle that sits in your USB port and instantly adds Bluetooth to your PC (note, however, that unlike USB pen-drives, you must first install the supplied Bluetooth drivers in order for your dongle to work).
Once both devices are Bluetooth-enabled, you can establish the connection. This is easily done, as Bluetooth devices can be made to search for one another. You must name each device beforehand, then select “search for device” in either your phone or PC, and that device will search for other Bluetooth devices within the local area (between 10m – 100m depending on the Bluetooth specification being used). All devices located will be presented to you, and you can then select the one you need. Depending on the security settings you’ve selected, either your PC or your phone will ask for a passcode. Enter a number (any number will do), and the other device being connected to will then also ask for a passcode. Again, enter the same number (the two numbers must match, but do not need to be specified in advance). Once the passcodes have been entered, the connection is (hopefully!) established, and file transfer can begin.
Transferring Files from Phone to PC
Most phones will let you select a file to be transferred, and offer you a selection of different ways to send it depending on the phone’s capabilities. For example, you could send it via MMS, Email, InfraRed, or Bluetooth. To transfer via Bluetooth, simply select the file, and then select “Send using Bluetooth” (or however your phone phrases it). Unfortunately, some phones only let you send one file at a time this way (are you listening, Sony Ericsson!!). Best to check your phone’s manual for specific instructions.
Transferring Files from PC to Phone
To transfer files in the other direction, you can use Windows Explorer from your PC (see image, above). Simply locate the file, right click on it, click ‘Send To’ and then select ‘Bluetooth’ and the device you’re connected to will then appear as a menu item. You simply select it, and your file will be uploaded to your phone. Note that in some circumstances, depending on your settings, you can simply send the file this way without establishing a connection first – the devices will establish the connection themselves automatically.
Bluetooth Uploading Summary
To upload a midlet via Bluetooth, then, simply do the following:
- Establish a Bluetooth connection between your phone and PC
- Select the .jar file you downloaded from the web
- Right click it, select ‘Send To->Bluetooth->(your mobile phone)’ and wait for it to be uploaded.
- Your phone will then ask where you want it to be stored, and that’s it!