This is a blog post about Microgram, a Telegram client for Java ME phones

J2ME development in 2023

2023-03-18

This is outdated. Please check this post instead.

Let’s not ask the apparent question why would you program in an ancient Java dialect for obsolete and pretty much restricted, closed up devices with outdated tools that barely run on current systems today. We leave that for another post. Let’s talk about the how.

Although most tools from back in the day focus on Windows (XP), it is possible to use Linux systems and since this is what I have (Linux Mint 20.3), I will describe how to set that up.

All you really need is the Wireless Toolkit. Install it (see below) and run bin/ktoolbar. Here you can create and build projects and run them in an emulator. I am sure it is possible to somehow integrate this for example in VS Code.

However, for line-by-line debugging and inline warnings that know about the old Java dialect and the J2ME limitations, I use an old NetBeans version like you would have if you developed an app back in the day. Here is how you should get it working on a current Linux Mint/Ubuntu system (I expect it to work on most other distributions, too).

Screenshot of NetBeans 8.2 on my system, with microgram code open
  1. Have an Ubuntu-based system running
  2. Install necessary 32bit libraries: sudo apt install libc6:i386 libxext6:i386 libxrender1:i386 libxtst6:i386 libxi6:i386 libxt6t64:i386 libstdc++6:i386
  3. Download and install NetBeans 8.2 with JDK 8u111
  4. Download and install the Wireless Toolkit 2.5.2. During installation, point it to JDK 1.7, 32bit.
  5. Go to Tools -> Plugins -> Settings and add the plugin repository http://plugins.archive.librebeans.org/catalogue/8.2/catalog.xml
  6. Install the Plugin Java ME Mobility
  7. Install the Plugin ProGuard obfuscator
  8. Tools -> Java Platforms -> Add Platform -> Java ME CLDC Platform Emulator, select the Wireless Toolkit folder.

Now, if you use a HiDPI display, NetBeans might look very zoomed out. You can install xpra from Ubuntu’s standard repository and run_scaled netbeans8.2/bin/netbeans. Then, NetBeans runs in 2x zoom. Or, if you are happy with the IDE running unscaled (or at least happier than the slightly blurred result that xpra gives you) but you still want the even smaller phone emulator 2x zoomed, you can open the file emulator in the Wireless Toolkit’s bin folder and modify the last command like this:

 run_scaled "${javapathtowtk}java" -Dkvem.home="${KVEM_HOME}" \ -Djava.library.path="${KVEM_HOME}/bin" \ -cp "${KVEM_LIB}/kenv.zip:${KVEM_LIB}/ktools.zip:${KVEM_LIB}/customjmf.jar" \ com.sun.kvem.environment.EmulatorWrapper "$@" 0 

Since Wireless Toolkit’s emulator can sometimes be buggy and become unusable (or if you want to have some kind of automated test suite running), you might want to download an alternative emulator: try Microemulator, I have it compiled for you here. Use it like this: java .jar path/to/microemulator.jar path/to/j2me/app.jar_or_jad. You can start a MIDlet directly from the command line, making automated tests possible.


This is a blog post about Microgram, a Telegram client for Java ME phones