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

imagej

Fix Ubuntu ImageJ

Edit the imagej startup script /usr/bin/imagej to have

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.

Alternative

Other alternatives include

JAVA_HOME=/usr/lib/jvm/default-java

Leave a Comment