← Back to team overview

desktop-packages team mailing list archive

[Bug 45348] Re: update-java-alternatives does not change the JAVA_HOME


I think tha JAVA_HOME should be automatically updated, or at least there should be a way to triggere a custom script to update it.
GVM has a nice

 # Attempt to set JAVA_HOME if it's not already set.
 if [ -z "${JAVA_HOME}" ] ; then
    if ${darwin} ; then
        [ -z "${JAVA_HOME}" -a -f "/usr/libexec/java_home" ] && export JAVA_HOME=$(/usr/libexec/java_home)
        [ -z "${JAVA_HOME}" -a -d "/Library/Java/Home" ] && export JAVA_HOME="/Library/Java/Home"
        [ -z "${JAVA_HOME}" -a -d "/System/Library/Frameworks/JavaVM.framework/Home" ] && export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
        javaExecutable="$(which javac 2> /dev/null)"
        [[ -z "${javaExecutable}" ]] && echo "GVM: JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME." && return

        readLink="$(which readlink 2> /dev/null)"
        [[ -z "${readLink}" ]] && echo "GVM: JAVA_HOME not set and readlink not available, please set JAVA_HOME." && return

        javaExecutable="$(readlink -f "${javaExecutable}")"
        javaHome="$(dirname "${javaExecutable}")"
        javaHome=$(expr "${javaHome}" : '\(.*\)/bin')
        [[ -z "${JAVA_HOME}" ]] && echo "GVM: could not find java, please set JAVA_HOME" && return
        export JAVA_HOME

You received this bug notification because you are a member of Desktop
Packages, which is subscribed to eclipse in Ubuntu.

  update-java-alternatives does not change the JAVA_HOME

Status in eclipse package in Ubuntu:
Status in java-common package in Ubuntu:
  Won't Fix

Bug description:
  java-common define a mechanism to define the variable JAVA_HOME for
  scripts/packages that require this variable. (could be eclipse,

  The script update-java-alternatives, that can be used to update the
  alternatives system for changing the implementation of the java
  commands, does not update the mechanism used for selecting the
  JAVA_HOME (used with /usr/share/java-common/jvm-find.sh and /etc/jvm).
  So even if I say thru update-java-alternatives that I want to use a
  specific version of java, the scripts that find Java using jvm-find.sh
  could use other Java VM commands, not the ones that I configured.

To manage notifications about this bug go to: