Improving the Java experience on Haiku

OpenJDK has opened up (pun intended) a world of new possiblities for Haiku, but it comes with some downsides. Some of those I can do nothing about. For example, Java apps use CTRL-O rather than Alt-O to open a file. This is something that could conceivably be fixed inside OpenJDK, but that's way above my paygrade. Also, a Java app does not get its own entry in the Deskbar. There is a rather bland Java icon and running apps are on its submenu. If it's any consolation, I see the same thing on other platforms.

However, there are two things that I can fix, and I am going to start work on that. ATM what starts a Java app on my system is actually a bash script that does three things:

  • find the directory in which the .jar file resides
  • cd to that directory
  • run the .jar file with "java -jar"

There are a few exceptions, but for most of my Java ports that does the trick.

I am now writing a stub loader in yab that does those same three things. Once compiled, the stub loader lets me associate files with it, which I then pass along to the jar file.

OK, what do you get out of this?

  • The app becomes associated with one or more filetypes. Right-click on a JPEG file, select Open With ..., and a Java bitmap editor becomes available to load it. Right-click on a ZIP file and open it with a Java decompression utility. You see where this is going, I'm sure. The whole thing becomes a little more integrated and Haiku-ish. There's a one-file limit to this, by the way. if you select multiple files and try to open them all, it is a little unpredictable which one will actually be opened.
  • Java apps, or at least the stub loader, will have their own unique app signatures, so they will start appearing in the Deskbar's "Recent applications" menu, even with submenus indicating recent files.

Cool, now what is the downside?

  • A compiled yab program is a lot bigger than a shell script. Expect every Java HPKG to increase by 200 KB or so. There will be cases where the stub loader takes up more space than the actual .jar file.
  • yab (, to be precise) becomes a dependency for every new-style Java app. But pkgman only has to download it once, really.
  • To run the stub loader you will need to run at least Haiku hrev49977
  • But that also means that Java apps, once comfortably scheduled as "any", now become "x86_gcc2" apps, because that is what I am compiling the stub loader as. GCC4-only and X86_64 Haiku users are left out in the cold. I don't think I have the energy to maintain two separate sets of Java apps, one "any" and the other "x86_gcc2". As for the other experimental architectures, forget about it. If I do this, I will convert all Java apps on the repo, one at a time, and overwrite the old ones.
  • Some Java apps will likely not work with this scheme. They may not be set up to accept files from the command-line or they may need to be started with a long, complicated java -classpath command rather than a straightforward java -jar. If most Java apps are enhanced this way but some are not, users may become frustrated.

So that is what I am looking at ATM. There is a lot of testing ahead, and I have to decide if the pros outweigh the cons. This is a $#/+load of work. If I decide to pull the trigger on this, there will be a lot fewer new Java apps and lots of -2, -3 and -4 updates. Each app will be distributed with its stub loader's yab code, of course. I'm a Public Domain kind of guy.

As an exeriment, I am putting up two initial offerings. SimplyHTML is a Rich Text Editor that saves files to HTML. It does not accept files from the command line, but you should find it in Recent applications.

(This is my first time using BeScreenCapture. Please be gentle.)

Restorizer is a decompression utility for .ZIP files. It will appear in  Recent Applications AND it will associate itself with the archive mimetypes so that you will see it in the Open With context menu for .zip, .tgz, .tar and .bzip2 files.

Please test these two apps and let me know if the change is worth it, either here or on the Haiku Facebook group. I'd appreciate your thoughts.




or you can just install from the repo in the usual way.

© Michel Clasquin-Johnson 2014-2017