J2ME development on modern Linux

For some reason I have decided I want to build a J2ME app in 2026. Don’t live like me.

Anyway, thankfully other people have already blazed this trail.

Specifically, this post is to provide an addendum to this post by the author of Microgram, a project to run Telegram on your old phone.

tl;dr:

  1. The author was using Ubuntu 24.04 LTS (or a derivative)
  2. To enable i386 packages, run sudo dpkg --add-architecture i386; sudo apt update
  3. If you are not using an Ubuntu desktop installation you MAY need to run the JDK installer (and NetBeans and other installed components) with _JAVA_AWT_WM_NONREPARENTING=1 prepended
  4. Reboot before you run the MIDLet emulator to save yourself some panic
  5. If you are using a different distro and/or distrobox, read on for relevant info

in more detail

So, what I’ve found as someone who is using a Fedora Kinoite installation in 2026, and therefore doing this via distrobox, is that there are some specifics which are difficult to ascertain from the above-linked post alone.

First of all, their distro. In a previous post they mentioned using Linux Mint 20.3. In the latter post, they don’t clarify. My first instinct was to use a similar-vintage Ubuntu distrobox, and 22.04 was a fairly close guess, with the caveat that libxt6t64 was missing; it appears it was named libxt6 in 22.04. That perhaps should’ve been a clue, but I didn’t learn that until later!

Also worthy of note that the incantation to add i386 package support on an x86_64 Ubuntu or derivative is to run sudo dpkg --add-architecture i386 and then run sudo apt update to fetch sources.

Anyway, I proceeded with the instructions under the distrobox on Fedora, and once I got to the point of trying to install the JDK, I ran into a bit of a brick wall. The installer’s GUI was blank. I am going to skip the full rundown but I installed a separate Ubuntu desktop VM to test which side of the Distrobox the issue was on, and it worked fine. Okay, so it’s something to do with my machine. Well!

It turns out that this is a well-known oldschool Java bug and was documented on the Arch wiki; Ubuntu’s default GNOME compositor for Wayland seemingly has a workaround for this implemented by default, but Fedora Kinoite’s KDE compositor for Wayland does not, so I ran the installer with the _JAVA_AWT_WM_NONREPARENTING=1 variable set, and it worked fine. Phew!

Now I know in theory distrobox has tools for exporting programs to the host system but the JDK installer had already created a shortcut to NetBeans on my desktop for me, so I rolled with it, updating it to run distrobox instead. I also added another Java workaround from the Arch wiki, which I don’t know if I specifically needed but it didn’t hurt. What I ended up with is as follows;

Name: NetBeans IDE 8.2 (Distrobox)
Program: /usr/local/bin/distrobox
Arguments: enter j2me --additional-flags '--env _JAVA_AWT_WM_NONREPARENTING=1 --env JAVA_OPTS=-Dsun.awt.disablegrab=true' -- $HOME/netbeans-8.2/bin/netbeans

I updated both the desktop shortcut and the launcher shortcut to match. I then rebooted. I am not sure why I needed to; perhaps my machine or my installation were haunted, but I could not get the emulator to launch a MIDLet without that step.

Then, magically, mercifully, it worked on my host machine running Fedora Kinoite 43. Ultimately having dug further I realised that the microgram author must been using Ubuntu 24.04 or equivalent, and their instructions would’ve worked fine there, but I only had the date and a hunch to go by!

So yes, running NetBeans circa 2016 and an SDK from 2008 on Linux circa 2026. I hope this mess of keywords saves someone some time.

Sorry for the lack of posts lately, things have been… weird.