Running imagej fails with the following message: 

   Open other images in this ImageJ panel as follows: 
     imagej -p 3 <image1> [<image2> ... <imageN>] 

   No JVM found to run ImageJ 
   Please apt-get install a JVM to run ImageJ or 
   set JAVA_HOME if it's not a JVM from a Debian Package. 

even though multiple JVM's are installed here. 

Bug #1556997 reported by Václav Šmilauer on 2016-03-14 

Pleas, **FIX**this bug in the current LTS release (16.04) 
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Solution:


The problem is that the /usr/bin/imagej script detects JAVA_HOME using 

   JAVA_HOME=$(/usr/sbin/update-java-alternatives -l | grep openjdk | sort | 
tail -1 | cut -d' ' -f 3) 

which is empty as the output of update-java-alternatives -l is (note multiple 
spaces between columns): 

java-1.6.0-openjdk-amd64 1061 /usr/lib/jvm/java-1.6.0-openjdk-amd64 
java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64 
java-1.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64 

and cut -d' ' -f3 selects space. The solution is to squeeze multiple spaces 
before running cut, so the line should read: 

   JAVA_HOME=$(/usr/sbin/update-java-alternatives -l | grep openjdk | sort | 
tail -1 | tr -s ' ' | cut -d' ' -f 3) 

which then gives the correct output (/usr/lib/jvm/java-1.8.0-openjdk-amd64 in 
my case) and makes imagej run as expected. 

-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss

Reply via email to