Published at 08:00 on 22 August 2022
I have now written two GUI applications using Kotlin and Swing, and it has left me wondering how useful the Java virtual machine (JVM) really can be for such purposes. When writing both applications, I ran into parts of Swing that simply do not work as advertised on the Mac. One thing worked for a long time, then became broken in newer versions of OpenJDK.
It’s sort of a shame. In theory at least, the JVM both insulates me from the hot mess that is the native Apple programming environment, and enables me to run my applications anywhere. The latter has been useful, since one of my applications, a clipboard manager, is enough of a productivity boost that I installed it on my Linux laptop I use for work. It just ran, no painful porting needed.
At this stage, I’m just rethinking my earlier conclusion that the JVM was the best way to write GUI applications. The Apple environment still is very much a hot mess from the programming side (always has been, probably always will be), so putting up with the JVM’s glitches may still be the preferred route. Moreover, the end result of Swing looks a lot closer to a native application than, say, GTK (which is also sometimes sold as a cross-platform GUI library) does. It’s just that the JVM is a lot glitchier than I had first imagined.