Fix ImageJ doesn't start from icon click on Ubuntu

Better alternative: install ImageJ directly

A bug in Ubuntu 16.04 stops ImageJ from starting from the icon.

Here’s how to fix Ubuntu’s system ImageJ version if it won’t start when clicking on the ImageJ icon.

The issue is that it isn’t finding JAVA_HOME as confirmed by typing in Terminal


Fix Ubuntu ImageJ

  1. Be sure Java JRE is installed:
   apt install openjdk-9-jre


   apt install openjdk-8-jre
  1. Edit Imagej startup script /usr/bin/imagej, adding line:
   JAVA_HOME=$(/usr/sbin/update-java-alternatives -l | grep openjdk | sort | tail -1 | tr -s ' ' | cut -d' ' -f 3)

notice the added tr -s ' ' to squash repeated spaces, which is what breaks cut.


Other alternatives include