The (Java) MIDlet Bible - Part II
By Menneisyys. Friday, 9. May 2008, 14:53:03
UPDATE (11/23/2007):
- in the meantime, thanks to XDA-Devs user defcomg, a new, third-party, free Bluetooth (JSR-82) library, BlueCove has been found, which supports IBM J9.
- In the second part of this article, I elaborate on how you can “hack” some Nokia classes into MIDlets so that they have a chance to run. I also explain how you can force the installation of MIDlets that, otherwise, are refused to be deployed because of missing library (for example, Bluetooth under Jbed) support.
1. BlueCove
Let’s start with the compatibility issues.
1.1 Real-world (!) compatibility
First, it’s only IBM J9-compliant (NO TAO, NO Jbed, NO Jblend). Even under J9, unfortunately, it’s (as of this writing) pretty much far away from REALLY working. While it correctly implements Bluetooth discovery, in general, it doesn’t go further and just crashes at actually connecting (not only discovering). I’ve tested this with both the Microsoft and the Widcomm Bluetooth stack, using version 6.1.1 (that is, the latest one) of IBM J9.
My compliance test results are as follows:
Super Bluetooth Hack 1.07 (note that the two (2nd/3rd) versions are exactly the same): doesn’t even start (IncompatibleClassChangeError with Vector)
Blooover discovering works; the actual connection doesn’t (IncompatibleClassChangeError with javax.microedition.io.Connection).
3D Constructo Combat: The same: it is able to discover other devices:

but, upon actually connecting to them (or, when you start it in server mode), it immediately crashes and exits.
1.2 Downloading, installing
If you still want to give it a try (again, it’s pretty much useless as of now!):
- Get bluecove-2.0.1.jar (version as of 11/23/2007) from HERE
- if you have WinRAR on your desktop Windows machine, enter the WinRAR bluecove-2.0.1.jar command;
- otherwise, rename bluecove-2.0.1.jar to bluecove-2.0.1.zip and click it so that its content is shown;
- extract bluecove_ce.dll and intelbth_ce.dll from the root of the archive; transfer them to the \bin subdirectory of your IBM J9 installation.
Note that if you don’t want to hunt for / extract these files yourself, I’ve made them available HERE as a standard ZIP file. Just unZIP it and transfer the two DLL's.
- copy bluecove.jar to the \lib\jclMidp20\ext directory of your IBM J9 installation. If “ext” doesn’t exist, create it.
- you’ll need to use special link files to start your Bluetooth-enabled MIDlets. This also means you don’t need to deploy your MIDlets under J9 at all as direct links of this type don’t require the MIDlets to be deployed beforehand. A typical link file looks like this:
255#"\Storage Card\ibm\bin\j9.exe" -jcl:midp20 -Dmicroedition.connection.pkgs=com.intel.bluetooth -cp MIDletName.jar "-jxe:\Storage Card\ibm\lib\jclMidp20\jclMidp20.jxe" MIDletName.jad
(An example link file is HERE as a real file.)
In here, change MIDletName to the filename of the MIDlet and, of course, change \Storage Card\ibm to the actual path of your IBM J9 installation.
Note that you’ll also need the JAD files in this setup. Should you not have them, use the free JADMaker to create them from JAR files (see the link for more info). If you don’t provide any absolute directories in the link file to the JAR / JAD files, then, you’ll need to copy the JAR file to the \lib\jclMidp20\ext directory of your IBM J9 installation before invoking the MIDlet through the link file. This is the same directory where bluecove.jar should reside. Also, the JAD file must be in the same directory as the lnk file itself.
2. Some additional hacking
2.1 Nokia classes missing in the game
If you try to run 3D Constructo Combat under J9 (I’ll elaborate on other MIDlet managers later), you’ll notice at once it doesn’t run. The sole reason for this is the lack of some Nokia-specific libraries in the MIDlet manager. You can, however, easily “hack” these classes into the JAR file of the MIDlet itself.
To do this, first, download THIS archive and unZIP it. Second, get WinRAR and, after installing it, enter the WinRAR jarfilename command to open the JAR (the main MIDlet) file. Now, just drag-and-drop the com directory (with all its subdirectories, of course) to the opened JAR file – making sure you don’t drop it on a directory, but in the root.
That’s all; now, your MIDlet might start.
Note that this definitely works with 3D Constructo Combat and J9 but will NOT work with Jbed, not even with the permission hacking I’ll explain in the following section.
(also see THIS Russian-language post for more info if interested. It doesn't contain much additional info, though.)
2.2 Permission hacking
As has been explained in the MIDlet Bible, some (very few!) MIDlets can’t even be deployed under Jbed (and other, less recommended) MIDlet managers. The reason for this is the deployment-time permission checking.
An example of these MIDlets is 3D Constructo Combat, which is refused to be deployed because of the unavailability of a library (here, a Bluetooth one):

You can easily help this and make MIDlets at least deployable (being actually runnable is another question). To do this, enter the WinRAR MidletFileName.jar command and extract the META-INF\MANIFEST.MF file. In there, look for the MIDlet-Permissions: row. For example, with 3D Constructo Combat, it’ll be the following:
MIDlet-Permissions: javax.microedition.io.Connector.bluetooth.client,javax.microedition.io.Connector.bluetooth.server
Just delete it and overwrite the original META-INF\MANIFEST.MF file with the new version, all this in the JAR file. Again, the new file no longer contains the MIDlet-Permissions: row. Now, the MIDlet at least becomes deployable as can also be seen in THIS screenshot. (This, again, doesn’t mean Jbed will be able to run it as well. It won’t, not even with the above-explained Nokia class hack.)
UPDATE (11/24/2007): At last: an M3G-capable, much more gaming-friendly Jbed version is out!
As is stated in the Bible (as can also be seen in the main game compliance chart), the recommended, current version of Jbed has very limited game compatibility. If you do want to use it and do need to run for example M3G titles, so far, you needed to turn to alternative and, in many respects, inferior MIDlet managers. Now, this has changed: thanks to XDA-Devs forum members viperj and defcomg, a brand new and really great version has been posted.
This is version 070524.2.1 - that is, slightly older than the current, 070802.2.2 version. The major disadvantage of this version, compared to the 2.2 one, is the complete lack of sound emulation.
It runs all the games running under the old, M3G-capable Jeodek (see their list HERE) and is very fast. Furthermore, it isn’t affected by the locale bug of version 2.2 – that is, the inability to run under any locales using a language with a non-Western alphabet (for example, most East-European languages).
I’ve tested it with I-Play’s FIA World Rally Championship 3D, Namco’s Arcade Golf and High Speed 3D. All these worked flawlessly (except for, of course, the complete lack of sound), unlike under 2.2. Under 2.2, they didn't even start or crashed later.
If you really need sound emulation and it’s indeed able to run the given title, you will still want to version 2.2 of Jbed, though. For example, it runs Simcity Societies with great sound.
Installation
To install it, just grab THIS file, unRAR it to, preferably, the “J” subdirectory on your storage card (so that jbed.exe is right in the “J” subdirectory) and import THIS Registry import file (change all occurrences of "Storage Card" to the name of your card if it has another name). You might also want to copy a link to the main executable, jbed.exe, to \Windows\Start Menu\Programs (or, just \Windows\Start Menu\ on MS Smartphones). I’ve created the link file HERE.
UPDATE (11/25/2007): PocketPlayers Reloaded frontpage
UPDATE (01/16/2008): In the meantime, it has turned out that you can use the non-M3G-specific version of Jbed (that is, Cloudyfa's 20070802.2.1) with any localizaton setting if and only if you start your specific MIDlet directly; that is, via a system-level shortcut.
I've also been using Opera Mini 4 on the Blackberry 8800, using the default MIDlet manager coming with the device. Note that, unlike the built-in Web browser and the mailer, you MUST specify the APN of your operator for it to work. Otherwise, it'll just report being unable to connect to the Net after starting (and a lengthy installation process). To do this, go to Options / Advanced / TCP?IP and enter your APN (for example, "Internet" with T-Mobile.)
UPDATE (01/25/2008): HF sticky in the WM Pro (PPC) forum (a screenshot of this)
UPDATE (02/01/2008):
There are new builds of both Jbed and Jblend (two excellent MIDlet Managers – see the Java MIDlet Bible for more info). Due to lack of time, I haven’t tested them. Both has been done by Da_G (his projects’ homepage is HERE) and are accessible HERE. Note that you MUST register yourself (it’s free and is done quickly) in order to access the page above (along with the download).
I hope I’ll be able to test them some time – along with the default Blackberry MIDlet manager. (I might wait with testing the latter until version 4.5 of BB OS is released, though.)
UPDATE (02/06/2008): Another Jbed MIDlet Manager version has been released: JRebeiro_EsmertecJbed_20071119.3.1.
It’s available HERE (at the bottom of the first page).
As I don’t have the time to thoroughly test it, feedback is REALLY welcome!
UPDATE (03/13/2008): New MIDlet manager in development: PhoneME; Jbed for WM2003(SE) released! See THIS for more info. It also has a link collection to the latest 4PDA.ru discussions.
Also, HERE, I've commented on Sun's announcing direct Java / MIDlet support for the Apple iPhone.
UPDATE (03/20/2008):
1. I’ve posted a generic update on the latest, 3.1 Jbed version HERE. As you can see, you’ll want to update to the new version, which is available for direct download HERE. The article, in addition to testing JRebeiro's Jbed 3.1 distro, discusses a Jbed hack that, to some degree, fix the Smartphone screen display bug in Jbed.
2. I’ve published a review of SHAPE Services’ TSMobiles: Terminal Service Client for Mobiles, a Java-based remote desktop accessor, RDP-compliant client. It works pretty well on Windows Mobile, both Pocket PC’s and MS Smartphones, under (the latest, 3.1 version of) Jbed, the best MIDlet manager for Windows Mobile. (Incidentally, this also shows what’s Java is capable of – this MIDlet is REALLY nice and fast, even by Windows Mobile standards!)
3. Pinned (sticky) at the highly popular MoDaCo Smartphone General Discussion (screenshot of this HERE)
4. THIS and THIS posts in THIS thread (from an iPAQ 210 user) might be of interest to, for example, Opera Mini users.
UPDATE (04/05/2008):
In the meantime, I’ve tested two versions of the latest, 3.1 version of Jbed and found out the following (starting with, currently, the latest and, unless you MUST install it on your storage card without any manual hacking, most recommended version):
1. Jbed Java 3.1 20080222 (available HERE; mirrored HERE for your convenience): this version runs flawlessly under WM5 (not only WM6 – note that some older versions of 3.1 are NOT WM5-compliant). It supports 3D (tested with Need for speed carbon and Night Fever; neither of them run under the non-3D-capable Cloudyfa 2.1), (as usual, excellent) sound. It can’t be directly installed onto a storage card, however. (As with some older versions, it’s possible it can be hacked there, though, with some manual file copying and registry / start menu link rewriting – I haven’t tested this.)
2. I’ve also thoroughly tested JBed_20071119.3.1_3dMod_HeapSizeFix_v2_wm6(lovetz1) linked from THIS MoDaCo thread. As a plus, it can be directly installed on a storage card, as opposed to the version above. It, however, doesn’t support sound at all. Otherwise, it seems it’s pretty much the same as the version above – except for WM5-compliance: I haven’t tested the WM5-compliant subversion. Again, I’d stick with the 20080222 (the first) version unless you really need every single byte in your built-in storage.
3. Note that neither version was able to run the s60v3 (Nokia) version of Command & Conquer 3: Tiberium Wars, the latest-and-greatest real-time strategy from EA Mobile – upon loading the mission (and displaying the progress bar), it just locks up. (Needless to say, it’s working flawlessly on the Nokia N95 v20). It seems no Jbed version is compatible with this excellent game – I’ve tested with several. This means the extended, “hacked” heap didn’t help with particular game. It might help with others, though.
4. Also note that the first beta of Opera Mini 4.1 has been released in the meantime. It simply ROCKS and is a must. See THIS for a complete review & tutorial.
UPDATE (04/11/2008): XDA-Devs forum member Ebenezer has released a version of Jbed 20080222 3.1 that can be directly installed to a storage card. It also supports sound and M3G (3D). Make sure you switch to this version if you prefer keeping your MIDlet manager and deployed MIDlets on your storage card. I've also got rid of the old, 2.1 Cloudyfa version (along with all the previously-mirrored and, now, outdated Jbed versions - this is why the old mirror links will no longer live) and made the new version of Jbed available HERE for direct download.
UPDATE (04/12/2008): Note that the just-recommended Ebenezer Jbed 3.1 doesn't create a link in Start Menu (not even when installed to the built-in storage); therefore, you'll need to manually create it. It's pretty simple: either copy (after, if you install Jbed on a storage card, changing "\Windows\jbed.exe" to "\Storage Card\Esmertec Java\jbed.exe" in it; if you're afraid of manually editing the file, I've created it for you; just right-click THIS and select Download / Save) to \Windows\Start Menu\Programs (on a touchscreen-enabled Pocket PC) or \Windows\Start Menu (on a touchscreen-less MS Smartphone). On Pocket PC's, you can also go the usual way: go to the home directory (for example, \Storage Card\Esmertec Java), highlight jbed.exe, select Copy; go to the target directory (\Windows\Start Menu\Programs or any subdirectory of it) and select Edit / Paste Shortcut. Then, you may still want to rename the just-created .lnk file so that you can remove the "Shortcut to" prefix.
UPDATE (04/14/2008): XDA-Devs forum member defcomg has just released a version of Jbed 3.1 not suffering from the Start menu link creation bug any more. It's currently available HERE and will be avalable on my DB back-end in a few hours. Therefore, if you still haven't installed Jbed 3.1, make sure you prefer this version to the others linked to above.
UPDATE (04/16/2008): In the meantime, the last-recommended defcomg version has turned out to be buggy; for example, if you install it on a storage card, it’ll still store the deployed files in \Windows\appdb - that is, the main storage. Furthermore, some people have reported (see for example THIS and THIS) it to be incompatible with Opera Mini 4.1 beta (it worked on my Wizard tho) – which isn’t the case with the previously-recommended Ebenezer version. Finally, it can’t be installed on a storage card NOT named Storage Card – that is, on a, say, non-English device or into an alternate Flash memory like “Storage” or “Flash disk” in the Ranju WM6.1 version v7.6 for the HTC Universal.
Therefore, you’ll want to switch back to the Ebenezer version available HERE (requires registration at XDA-Devs) or HERE (direct download from my DB back-end) if you encounter these problems and want to keep your deployed MIDlets on your card. Again, note that you will need to manually create (copy) a shortcut to Jbed.exe with this version – this is the only problem with it. It runs (the signed version of) Opera Mini 4.1b (and, of course, all the other compatible MIDlets, including games) just great.
UPDATE (04/19/2008):
1. Unfortunately, it seems none of the Jbed 3.1 versions are able to run Opera Mini 4.1 beta on touchscreen-less MS Smartphones (but NOT on Pocket PC's!!!) if you switch to other apps (for example, the home screen) and, then, back, you will no longer be able to control Opera Mini. I've tested this on my WM5 s310 / Oxygen (major problems) and, with HTC's recently-released ROM upgrade, upgraded WM6 s710 / Vox (not that frequent problems but still annoying). At XDA-Devs, other people have also reported the same problem with their Smartphones.
If you do encounter problems like this and can't refrain from task switching, you'll want to downgrade to the Cloudyfa 2.1 version available HERE. Note that it can safely co-exist with 3.1 if you've installed the latter in another directory (for example, on a storage card or a flash disk) - then, it's only the file associations that will be needed to, say, quickly switched if you don't want to manually deploy a MIDlet from inside the GUI of the specific MIDlet manager. That is, you don't need to delete Jbed 3.1 if you plan to keep it for example for M3G gaming.
Note that touchscreen-equipped Pocket PC's do NOT suffer from this problem!
2. Ebenezer has released a fixed version of his Jbed 3.1 MIDlet manager HERE. Now, it does create a link file in Start Menu / Programs on both Pocket PC's and MS Smartphones. It also installs to any target media (not only "Storage Card"s) without problems. Note one caveat, though: the link file (the one the installer puts in the Start menu) has \Storage Card wired in, which doesn't work with any storage card (or flash disk) named other than "Storage Card". Hope this is fixed some time; in the meantime, just manually edit the link file to have the correct path.
UPDATE (04/25/2008):
1. XDA-Developers forum member m3uch4 has published a decent tutorial on creating shortcuts for Jbed – highly recommended.
2. badbob001, who has just released a new, 0.09b version of his StartOperaMini by adding the exclude list feature (and a LOT of other goodies – make sur eyou check out the dedicated XDA-Devs thread!), has found out a pretty easy-to-use fix for the above-mentioned Jbed 3.1 resume bug: if you have Direct Address Input disabled (it’s enabled by default), press #1 to open the Enter Address window. Then cancel out and the Opera Mini screen should be responsive again. (BTW, this might work with other dialogs requiring manual input – I don’t know, haven’t tested the latter.) Incidentally, he has also found out the problem is surely a Jbed-related issue because the Gmail MIDlet is also affected by it. Let me cite him: “One thing you may want to investigate is Jbed's background running option. If I run jbed, turn on background running, then launch opera mini, the problem seems to not occur with my limited testing. Since I prefer to directly launch opera mini, it would also be nice to have a way to enable background running by default.
If enabling background running really fixes the issue, then I guess it's a bug with jbed 3.1 restoring itself from its own suspend mode.”
