From: Debian Java Maintainers Date: Fri, 4 Oct 2013 13:10:23 +0200 Subject: 05_freemind_sh_wrapper =================================================================== --- freemind/freemind.sh | 55 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 21 deletions(-) Index: freemind-1.0.1/freemind/freemind.sh =================================================================== --- freemind-1.0.1.orig/freemind/freemind.sh 2014-07-29 20:50:15.338376977 +0200 +++ freemind-1.0.1/freemind/freemind.sh 2014-07-29 20:50:15.330376977 +0200 @@ -22,6 +22,13 @@ set -x fi +# debug also java-wrapper +if [ -n "${DEBUG}" ] +then + DEBUG_WRAPPER=1 + export DEBUG_WRAPPER +fi + ########## FUNCTIONS DEFINITIONS ####################################### _debug() { @@ -47,45 +54,45 @@ findjava() { # We try hard to find the proper 'java' command - if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ] + if [ -n "${JAVA_CMD}" ] && [ -x "${JAVA_CMD}" ] then - _debug "Using \$JAVACMD to find java virtual machine." + _debug "Using \$JAVA_CMD to find java virtual machine." elif [ -n "${JAVA_BINDIR}" ] && [ -x "${JAVA_BINDIR}/java" ] then - JAVACMD="${JAVA_BINDIR}/java" + JAVA_CMD="${JAVA_BINDIR}/java" _debug "Using \$JAVA_BINDIR to find java virtual machine." elif [ -n "${JAVA_HOME}" ] && [ -x "${JAVA_HOME}/bin/java" ] then - JAVACMD="${JAVA_HOME}/bin/java" + JAVA_CMD="${JAVA_HOME}/bin/java" _debug "Using \$JAVA_HOME to find java virtual machine." else - JAVACMD=$(which java) - if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ] + JAVA_CMD=$(which java) + if [ -n "${JAVA_CMD}" ] && [ -x "${JAVA_CMD}" ] then _debug "Using \$PATH to find java virtual machine." elif [ -x /usr/bin/java ] then _debug "Using /usr/bin/java to find java virtual machine." - JAVACMD=/usr/bin/java + JAVA_CMD=/usr/bin/java fi fi # if we were successful, we return 0 else we complain and return 1 - if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ] + if [ -n "${JAVA_CMD}" ] && [ -x "${JAVA_CMD}" ] then - _debug "Using '$JAVACMD' as java virtual machine..." + _debug "Using '$JAVA_CMD' as java virtual machine..." if [ -n "${DEBUG}" ] then - "$JAVACMD" -version >&2 + "$JAVA_CMD" -version >&2 fi - if (! "${JAVACMD}" -version 2>&1 | grep -qe 'Java(TM)' \ + if (! "${JAVA_CMD}" -version 2>&1 | grep -qe 'Java(TM)' \ -e 'OpenJDK') then _error "Your Java VM is not a complete implementation," \ "=======================================" \ "FREEMIND WILL MOST PROBABLY *NOT* WORK," \ "=======================================" \ - "define JAVACMD, JAVA_BINDIR, JAVA_HOME or PATH in order" \ + "define JAVA_CMD, JAVA_BINDIR, JAVA_HOME or PATH in order" \ "to point to such a VM. See the manpage of freemind(1) for details." JAVA_TYPE=other else @@ -94,7 +101,7 @@ return 0 else _error "Couldn't find a java virtual machine," \ - "define JAVACMD, JAVA_BINDIR, JAVA_HOME or PATH." \ + "define JAVA_CMD, JAVA_BINDIR, JAVA_HOME or PATH." \ "See the manpage of freemind(1) for details." return 1 fi @@ -141,10 +148,16 @@ _source /etc/freemind/freemindrc _source ~/.freemind/freemindrc -findjava -if [ $? -ne 0 ] -then - exit 1 +if [ -r /usr/lib/java-wrappers/java-wrappers.sh ] +then # the Debian method + . /usr/lib/java-wrappers/java-wrappers.sh + require_java_runtime java6 +else + findjava + if [ $? -ne 0 ] + then + exit 1 + fi fi output_debug_info @@ -211,11 +224,11 @@ ${freedir}" if [ "${JAVA_TYPE}" = "sun" ] then - _debug "Calling: '${JAVACMD} -Dfreemind.base.dir=${freedir} -cp ${CLASSPATH} freemind.main.FreeMindStarter $@'." + _debug "Calling: '${JAVA_CMD} -Dfreemind.base.dir=${freedir} -cp ${CLASSPATH} freemind.main.FreeMindStarter $@'." ( echo "${DEBUG}" | grep -qe "exit" ) && exit 0 # do not start FreeMind - "${JAVACMD}" -Xmx256M -Dfreemind.base.dir="${freedir}" -cp "${CLASSPATH}" freemind.main.FreeMindStarter "$@" + "${JAVA_CMD}" -Xmx256M -Dfreemind.base.dir="${freedir}" -cp "${CLASSPATH}" freemind.main.FreeMindStarter "$@" else # non-Sun environments don't work currently. - _debug "Calling: '${JAVACMD} -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D -Dfreemind.base.dir=${freedir} -cp ${CLASSPATH} freemind.main.FreeMindStarter $@'." + _debug "Calling: '${JAVA_CMD} -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D -Dfreemind.base.dir=${freedir} -cp ${CLASSPATH} freemind.main.FreeMindStarter $@'." ( echo "${DEBUG}" | grep -qe "exit" ) && exit 0 # do not start FreeMind - "${JAVACMD}" -Xmx256M -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D -Dfreemind.base.dir="${freedir}" -cp "${CLASSPATH}" freemind.main.FreeMindStarter "$@" + "${JAVA_CMD}" -Xmx256M -Dgnu.java.awt.peer.gtk.Graphics=Graphics2D -Dfreemind.base.dir="${freedir}" -cp "${CLASSPATH}" freemind.main.FreeMindStarter "$@" fi