How to install Java 8?

I ran into the zulu repository thing earlier today too. Not sure what is going on, it was working earlier in the week. Here are the steps that I followed, and I was able to get it running. This was on a fresh openhabian install on a Raspberry Pi, so the URL is for the ARM version:

  1. Download a good copy of zulu java. This thread from a few days ago recommends 1.8.0_222, but it wouldn’t actually run for me so I used http://cdn.azul.com/zulu-embedded/bin/zulu8.31.1.122-jdk1.8.0_181-linux_aarch32hf.tar.gz

  2. Extract the archive into /opt/jdk: sudo tar -xzf zulu8.31.1.122-jdk1.8.0_181-linux_aarch32hf.tar.gz -C /opt/jdk

  3. Confirm that it works. This is where 222 failed for me. /opt/jdk/zulu8.31.1.122-jdk1.8.0_181-linux_aarch32hf/bin/java --version should output a version number, not an error.

  4. Set your newly-unpacked java as the default system java. Benjy kindly posed the instructions: sudo update-alternatives --install /usr/bin/java java /opt/jdk/zulu8.31.1.122-jdk1.8.0_181-linux_aarch32hf/bin/java 1 and sudo update-alternatives --install /usr/bin/javac javac /opt/jdk/zulu8.31.1.122-jdk1.8.0_181-linux_aarch32hf/bin/javac 1

  5. At this point you should have working Java. For me I had a half-installed openhab and re-running /boot/first-boot.bash would still error out trying to install java. I edited out the line java_install_or_update "$java_arch" from /opt/openhabian/openhabian-setup.sh (somewhat based on this thread) then ran that file (without running first-boot.bash, which seems to recreate openhabian-setup.sh): sudo bash /opt/openhabian/openhabian-setup.sh and had a fully-installed openhab.

  6. All that should be left are the last two steps contained in first-boot.bash: sudo rm -f /opt/openHABian-install-inprogress; sudo touch /opt/openHABian-install-successful

I’m hopeful that this was just someone at Azul pushing to prod on a Friday and not answering pages the whole weekend.