<HTML><BODY>Running imagej fails with the following message: <br> <br>   Open other images in this ImageJ panel as follows: <br>     imagej -p 3 <image1> [<image2> ... <imageN>] <br> <br>   No JVM found to run ImageJ <br>   Please apt-get install a JVM to run ImageJ or <br>   set JAVA_HOME if it's not a JVM from a Debian Package. <br> <br>even though multiple JVM's are installed here. <br> <br>Bug #1556997 reported by Václav Šmilauer on 2016-03-14 <br> <br><span style="text-decoration: underline; font-size: 18px;"><strong>Pleas, **FIX**this bug in the current LTS release (16.04) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</strong></span><br> <br><span style="text-decoration: underline;"><span data-mce-style="font-size: 24px;" style="font-size: 24px;"><strong>Solution:</strong></span></span><br><br> <br>The problem is that the /usr/bin/imagej script detects JAVA_HOME using <br> <br>   JAVA_HOME=$(/usr/sbin/update-java-alternatives -l | grep openjdk | sort | tail -1 | cut -d' ' -f 3) <br> <br>which is empty as the output of update-java-alternatives -l is (note multiple spaces between columns): <br> <br>java-1.6.0-openjdk-amd64 1061 /usr/lib/jvm/java-1.6.0-openjdk-amd64 <br>java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64 <br>java-1.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64 <br> <br>and cut -d' ' -f3 selects space. The solution is to squeeze multiple spaces before running cut, so the line should read: <br> <br>   JAVA_HOME=$(/usr/sbin/update-java-alternatives -l | grep openjdk | sort | tail -1 | tr -s ' ' | cut -d' ' -f 3) <br> <br>which then gives the correct output (/usr/lib/jvm/java-1.8.0-openjdk-amd64 in my case) and makes imagej run as expected. <br> <br></BODY></HTML>