Haiku is an open source operating system inspired by BeOS, an operating system developed by Be Inc in the 90s. Although it’s still in a beta phase, Haiku is surprisingly fast and responsible. You can find many reviews on the web about it.
During the last few days I have been playing with it on a virtual machine on my Intel NUC. The environment for Java development is not prepared out of the box, therefore I am writing this small guide with the steps to setup a Java development environment on Haiku. This guide focuses on the most basic thing for a developer: installing the tools for building, testing and writing your your software.
Installing a JDK
You can use the application HaikuDepot to install a JDK. There are packages for Java 8 to 14. It seems there’s no package for Java 17 yet, however. At this moment, the featured packages display a build for the Java 8. Unless you need that ancient version skip it, instead search for
opendjdk on the depot to find additional packages.
Alternatively, you can also install the package command line. Open the terminal (you can find it on the application list on the Menu on the top right) and type:
pkgman install openjdk11_default
SDKMAN! does not support Haiku, so you’ll have to manually install the usual tooling for Java development. I’ll describe the steps I took to install Apache Maven. You can probably follow the same steps to install other tools.
Download the latest version from the project website. The file is going to be saved on the
~/Desktop directory. At this time, Maven 3.8.6 is the latest version, therefore the downloaded file on my system is:
Extracting the file using the Expander
You can double click the package on your desktop to use the Expander utility to extract the file. Choose
/boot/home/tools as the destination directory.
Extracting the file using the command line interface (CLI)
Extracting the file via CLI is similar to what you would do on Linux, *BSDs or MacOS. You can use the following command:
mkdir -p ~/tools ; tar -xvf ~/Desktop/apache-maven.3-8.6-bin.tar.gz -C ~/tools
Tip: just like on Linux, you can use the command
readlink -f ~/Desktop/apache-maven.3-8.6-bin.tar.gz to resolve the full directory of the downloaded file – that would be
/boot/home/Desktop/apache-maven.3-8.6-bin.tar.gz in this case.
Setting up Maven
If you had extracted the file via UI, then open the terminal.
Switch your directory to
~/tools and create a symbolic link to the extracted Apache Maven directory.
ln -s apache-maven-3.8.6 apache-maven
You’ll probably notice that if you invoke Maven via CLI, it won’t work. That’s because the scripts that launch Maven are not on the path.
You can do so by adding it to the PATH variable. This customization is similar to what is done on Linux, *BSDs and MacOS, however the file location is slightly different. To add to the patch, edit the
Note 1: Haiku comes with Nano installed by default. If you prefer Vim, it can be found on the HaikuDepot.
You can add the following contents to the file:
#Common path to install the tools you need for Java development
# Point the M2_HOME variable to the Maven installation directory
# Append each too to the PATH variable, so it can be found when using the CLI
Save the file and exit the shell using the exit command.
Open a new shell window and type:
mvn --version. It should print the Maven version.
Now you should be ready to try building your project.
Note: some projects may enforce OS restrictions on the build (i.e.: using maven plugins and so on – please don’t you this kind of thing unless you have a very serious reason for it). For example, to disable the OS check on the os-maven-plugin, you can use
mvn -DfailOnUnknownOS=false <target>
Then, at last, you can install an IDE, so you can write and change the code. Haiku comes with a package for IntelliJ IDEA. The package is a bit old, but it should not prevent you from writing code and enjoying most the features of this awesome IDE.
This looks cool! What should I know before playing more with it?
Here’s some of the problems I encountered building a large project. They may or may not be related to Haiku because I ran it on a virtual machine (VM) on a host running Fedora 36 and I did not diagnose the root cause of any of them:
- Transient name resolution problems transferring artifacts from my local maven repository
- Memory pressure seems to cause the system to become unresponsive (this is just a guess – I did not diagnose the problem)
- Git seems very slow and pulling with rebase a large repository causes the system to hang.
- The builtin terminal in IntelliJ does not work.
I want to highlight that, by no means, this is detrimental to the system – it’s a beta after all and I never investigated the root cause.
Haiku is a fun OS to play with. Although there were some hiccups here and there, this is to me part of the fun of playing with unstable/beta software.
I was particularly impressed about how fast and responsive it was. It was fast even though I was using it on a virtual machine and accessing using VNC.
Now I am considering buying a cheap SSD so I can install it on my desktop, have a better feel of how it works on actual hardware and not have to worry so much with disk space.