[Debian-med-packaging] Bug#505315: ImageJ chooses wrong java home

Onkar Shinde onkarshinde at gmail.com
Tue Nov 11 17:30:26 UTC 2008


Package: imagej

Following bug is reported in Ubuntu by Peter Husen. [1]

***************
ImageJ fails to run on an amd64 system if ia32-sun-java6-bin is
installed. It fails with the error message
> Running a 64-bit JVM is not supported on this platform.
This seems to be due to the script /usr/bin/imagej setting JAVA_HOME by
   JAVA_HOME=$(/usr/sbin/update-java-alternatives -l java-6-openjdk |
head -1 | cut -d' ' -f 3)
i.e. the top line returned from 'update-java-alternatives -l'. This
happens to be ia32-java-6-sun, even though /etc/alternatives/java
points to /usr/lib/jvm/java-6-openjdk/jre/bin/java. The script then
finds out using 'uname -m' that it is a 64 bit architecture, and
therefore passes '-d64' to java. This would work on a 64 bit jvm, but
not on the 32 bit jvm chosen by the script.

I guess update-java-alternatives is not the correct way to determine
the default java home. I don't know the correct approach, but this
seems to work for me:
   JAVA_HOME=$(dirname $(dirname $(dirname $(readlink /etc/alternatives/java))))

Also, I guess the script strictly should make sure it's a 64 bit jvm
instead of just using 'uname -m'
***************

The launcher script is not modified in Ubuntu. Hence I thought it was
better to forward the bug to Debian so it can be fixed in proper way
and the fix then carried to Ubuntu.

[1] https://launchpad.net/bugs/294753





More information about the Debian-med-packaging mailing list