aboutsummaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorGreg Lewis <glewis@FreeBSD.org>2004-11-11 19:17:37 +0000
committerGreg Lewis <glewis@FreeBSD.org>2004-11-11 19:17:37 +0000
commit280df4e4cedc6b10cf8c1175ee494973c9160f98 (patch)
treea58a71a5a69e746e37ea04a1da0ca92adb314d26 /java
parent9ba5d267af2f0cbd6eff4441fbfbd0b071baad95 (diff)
downloadports-280df4e4cedc6b10cf8c1175ee494973c9160f98.tar.gz
ports-280df4e4cedc6b10cf8c1175ee494973c9160f98.zip
Notes
Diffstat (limited to 'java')
-rw-r--r--java/javavmwrapper/Makefile13
-rw-r--r--java/javavmwrapper/pkg-deinstall45
-rw-r--r--java/javavmwrapper/pkg-install20
-rw-r--r--java/javavmwrapper/pkg-plist1
-rw-r--r--java/javavmwrapper/src/javavmwrapper.sh469
5 files changed, 512 insertions, 36 deletions
diff --git a/java/javavmwrapper/Makefile b/java/javavmwrapper/Makefile
index 780013538979..6f69805e8ca5 100644
--- a/java/javavmwrapper/Makefile
+++ b/java/javavmwrapper/Makefile
@@ -8,12 +8,12 @@
#
PORTNAME= javavmwrapper
-PORTVERSION= 1.5
+PORTVERSION= 2.0
CATEGORIES= java
MASTER_SITES= # none
DISTFILES= # none
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= glewis@FreeBSD.org
COMMENT= Wrapper script for various Java Virtual Machines
NO_BUILD= yes
@@ -24,6 +24,7 @@ SCRIPTS= classpath javavmwrapper
# This is normally defined by bsd.java.mk when USE_JAVA is defined, but
# we can't do that here since it would result in a circular dependency
JAVALIBDIR= ${LOCALBASE}/share/java/classes
+PKGINSTALL= ${WRKDIR}/pkg-install
do-fetch:
@${DO_NADA}
@@ -32,13 +33,19 @@ do-configure:
.for _script in ${SCRIPTS}
${SED} -e 's|%%PREFIX%%|${PREFIX}|;' \
-e 's|%%JAVALIBDIR%%|${JAVALIBDIR}|;' \
- <${SRC}/${_script}.sh >${WRKDIR}/${_script}.sh
+ ${SRC}/${_script}.sh >${WRKDIR}/${_script}.sh
.endfor
+ ${SED} -e 's|%%LOCALBASE%%|${LOCALBASE}|;' pkg-install > ${PKGINSTALL}
do-install:
${INSTALL_SCRIPT} ${WRKDIR}/classpath.sh ${PREFIX}/bin/classpath
${INSTALL_SCRIPT} ${WRKDIR}/javavmwrapper.sh ${PREFIX}/bin/javavm
${LN} -sf ${PREFIX}/bin/javavm ${PREFIX}/bin/registervm
${LN} -sf ${PREFIX}/bin/javavm ${PREFIX}/bin/unregistervm
+ ${LN} -sf ${PREFIX}/bin/javavm ${PREFIX}/bin/checkvms
+
+post-install:
+ ${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGDIR}/pkg-install ${PKGNAME} \
+ POST-INSTALL
.include <bsd.port.mk>
diff --git a/java/javavmwrapper/pkg-deinstall b/java/javavmwrapper/pkg-deinstall
new file mode 100644
index 000000000000..3075b66c5428
--- /dev/null
+++ b/java/javavmwrapper/pkg-deinstall
@@ -0,0 +1,45 @@
+#!/bin/sh
+#
+# $FreeBSD$
+
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin
+
+# Run this script at the pre-deinstall stage
+if [ "x${2}" != "xDEINSTALL" ]; then
+ exit 0
+fi
+
+# The configuration file
+CONF="${PKG_PREFIX}/etc/javavms"
+
+# Ensure the configuration file exists
+if [ ! -f "${CONF}" ]; then
+ exit 0
+fi
+
+# Ensure the configuration file has the correct permissions
+if [ ! -r "${CONF}" ]; then
+ echo "error: can't read configuration file ${CONF}" 1>&2
+ exit 1
+fi
+
+# Destroy the symbolic links that were created for every executable for a VM.
+cat "${CONF}" | \
+(
+while read JAVAVM; do
+ VM=`echo "${JAVAVM}" | sed -E 's|[[:space:]]*#.*||' 2>/dev/null`
+ JAVA_HOME=`dirname "${VM}"`
+ JAVA_HOME=`dirname "${JAVA_HOME}"`
+ for exe in "${JAVA_HOME}"/bin/* "${JAVA_HOME}"/jre/bin/*; do
+ exe=`basename "${exe}"`
+ if [ -L "${PKG_PREFIX}/bin/${exe}" -a \
+ "`ls -ld "${PKG_PREFIX}/bin/${exe}" 2>/dev/null | \
+ awk '/->/{print $NF;exit 0}END{exit 1}'`" = \
+ "${PKG_PREFIX}/bin/javavm" ]; then
+ rm "${PKG_PREFIX}/bin/${exe}"
+ fi
+ done;
+done;
+)
+
+exit 0
diff --git a/java/javavmwrapper/pkg-install b/java/javavmwrapper/pkg-install
new file mode 100644
index 000000000000..8f6d67f8195a
--- /dev/null
+++ b/java/javavmwrapper/pkg-install
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# $FreeBSD$
+
+LOCALBASE=%%LOCALBASE%%
+
+# This script runs during post-install
+if [ "x${2}" != "xPOST-INSTALL" ]; then
+ exit 0
+fi
+
+# Ensure all JDKs and JREs are installed
+for jvm in "${LOCALBASE}"/*jdk* "${LOCALBASE}"/*jre*; do
+ if [ -x "${jvm}/bin/java" ]; then
+ "${PKG_PREFIX}"/bin/registervm "${jvm}/bin/java"
+ fi
+done
+
+# Ensure all VMs are configured correctly
+"${PKG_PREFIX}"/bin/checkvms
diff --git a/java/javavmwrapper/pkg-plist b/java/javavmwrapper/pkg-plist
index dfb07441ae51..8ec477d3c9db 100644
--- a/java/javavmwrapper/pkg-plist
+++ b/java/javavmwrapper/pkg-plist
@@ -2,3 +2,4 @@ bin/classpath
bin/javavm
bin/registervm
bin/unregistervm
+bin/checkvms
diff --git a/java/javavmwrapper/src/javavmwrapper.sh b/java/javavmwrapper/src/javavmwrapper.sh
index 17dfa4df57e2..b6447448911f 100644
--- a/java/javavmwrapper/src/javavmwrapper.sh
+++ b/java/javavmwrapper/src/javavmwrapper.sh
@@ -15,77 +15,340 @@
# Maxim Sobolev
# ----------------------------------------------------------------------------
#
+# ----------------------------------------------------------------------------
+# "THE BEER-WARE LICENSE" (Revision 42, (c) Poul-Henning Kamp):
+# Greg Lewis <glewis@FreeBSD.org> substantially rewrote this file. As long
+# as you retain this notice you can do whatever you want with this stuff. If
+# we meet some day, and you think this stuff is worth it, you can buy me a
+# beer in return.
+#
+# Greg Lewis
+# ----------------------------------------------------------------------------
+#
# $FreeBSD$
#
-# MAINTAINER= sobomax@FreeBSD.org
+# MAINTAINER=java@FreeBSD.org
+
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin
PREFIX="%%PREFIX%%"
CONF="${PREFIX}/etc/javavms"
IAM=`basename "${0}"`
+MAKE=/usr/bin/make
-tryrunVM () {
+#
+# Try to run a Java command.
+#
+tryJavaCommand () {
+ # Check for the command being executable and exec it if so.
if [ -x "${1}" ]; then
exec "${@}"
fi
- /bin/echo "${IAM}: warning: couldn't start specified JavaVM - \"${1}\"" >&2
+ echo "${IAM}: warning: couldn't run specified Java command - \"${1}\"" >&2
+}
+
+#
+# Create symbolic links for all of a Java VMs executables.
+#
+createJavaLinks () {
+ for exe in "${1}"/bin/* "${1}"/jre/bin/*; do
+ if [ -x "${exe}" -a \
+ ! -d "${exe}" -a \
+ "`basename "${exe}"`" = "`basename "${exe}" .so`" -a \
+ ! -e "${PREFIX}/bin/`basename "${exe}"`" -a \
+ -w "${PREFIX}/bin" ]; then
+ ln -s "${PREFIX}/bin/javavm" \
+ "${PREFIX}/bin/`basename "${exe}"`" 2>/dev/null
+ fi
+ done
}
+#
+# Sort the configuration file
+#
+sortConfiguration () {
+ if [ ! -f "${CONF}" ]; then
+ return
+ fi
+
+ if [ ! -w "${CONF}" -o ! -r "${CONF}" ]; then
+ echo "${IAM}: error: can't read/write ${CONF} configuration file!" >&2
+ return
+ fi
+
+ ifs="${IFS}"
+ IFS=:
+ cat "${CONF}" | \
+ (
+ export JAVAVMS
+ while read JAVAVM; do
+ VM=`echo "${JAVAVM}" | sed -E 's|[[:space:]]*#.*||' 2>/dev/null`
+ # Check the VM actually exists
+ if [ ! -e "${VM}" ]; then
+ continue
+ fi
+ # Skip duplicate VMs
+ if [ ! -z "${JAVAVMS}" ]; then
+ for _JAVAVM in ${JAVAVMS}; do
+ if [ -z "${_JAVAVM}" ]; then
+ continue
+ fi
+ _VM=`echo "${_JAVAVM}" | sed -E 's|[[:space:]]*#.*||' 2>/dev/null`
+ if [ "x${VM}" = "x${_VM}" ]; then
+ continue 2
+ fi
+ done
+ fi
+ VM=`dirname "${VM}"`
+ VM=`dirname "${VM}"`
+ VM=`basename "${VM}"`
+ _JAVAVMS=:
+ for _JAVAVM in ${JAVAVMS}; do
+ if [ -z "${_JAVAVM}" ]; then
+ continue
+ fi
+ if [ -z "${JAVAVM}" ]; then
+ _JAVAVMS="${_JAVAVMS}:${_JAVAVM}"
+ continue
+ fi
+ _VM=`echo "${_JAVAVM}" | sed -E 's|[[:space:]]*#.*||' 2>/dev/null`
+ _VM=`dirname "${_VM}"`
+ _VM=`dirname "${_VM}"`
+ _VM=`basename "${_VM}"`
+ VERSION=`echo ${VM} | sed -e 's|[^0-9]*||' 2>/dev/null`
+ _VERSION=`echo ${_VM} | sed -e 's|[^0-9]*||' 2>/dev/null`
+ if [ "${VERSION}" \> "${_VERSION}" ]; then
+ _JAVAVMS="${_JAVAVMS}:${JAVAVM}:${_JAVAVM}"
+ JAVAVM=
+ continue
+ elif [ "${VERSION}" \< "${_VERSION}" ]; then
+ _JAVAVMS="${_JAVAVMS}:${_JAVAVM}"
+ continue
+ else
+ case "${VM}" in
+ diablo-jdk*)
+ _JAVAVMS="${_JAVAVMS}:${JAVAVM}:${_JAVAVM}"
+ JAVAVM=
+ continue
+ ;;
+ diablo-jre*|jdk*)
+ case "${_VM}" in
+ diablo*)
+ _JAVAVMS="${_JAVAVMS}:${_JAVAVM}"
+ continue
+ ;;
+ *)
+ _JAVAVMS="${_JAVAVMS}:${JAVAVM}:${_JAVAVM}"
+ JAVAVM=
+ continue
+ ;;
+ esac
+ ;;
+ jre*|linux-sun-jdk*)
+ case "${_VM}" in
+ diablo*|j*)
+ _JAVAVMS="${_JAVAVMS}:${_JAVAVM}"
+ continue
+ ;;
+ *)
+ _JAVAVMS="${_JAVAVMS}:${JAVAVM}:${_JAVAVM}"
+ JAVAVM=
+ continue
+ ;;
+ esac
+ ;;
+ linux-sun-jre*|linux-blackdown-jdk*)
+ case "${_VM}" in
+ diablo*|j*|linux-sun*)
+ _JAVAVMS="${_JAVAVMS}:${_JAVAVM}"
+ continue
+ ;;
+ *)
+ _JAVAVMS="${_JAVAVMS}:${JAVAVM}:${_JAVAVM}"
+ JAVAVM=
+ continue
+ ;;
+ esac
+ ;;
+ linux-blackdown-jre*|linux-ibm-jdk*)
+ case "${_VM}" in
+ diablo*|j*|linux-sun*|linux-blackdown*)
+ _JAVAVMS="${_JAVAVMS}:${_JAVAVM}"
+ continue
+ ;;
+ *)
+ _JAVAVMS="${_JAVAVMS}:${JAVAVM}:${_JAVAVM}"
+ JAVAVM=
+ continue
+ ;;
+ esac
+ ;;
+ esac
+ _JAVAVMS="${_JAVAVMS}:${_JAVAVM}"
+ fi
+ done
+ JAVAVMS="${_JAVAVMS}"
+ if [ ! -z "${JAVAVM}" ]; then
+ JAVAVMS="${JAVAVMS}:${JAVAVM}"
+ fi
+ done;
+ if [ ! -z "${JAVAVMS}" ]; then
+ rm "${CONF}"
+ for JAVAVM in ${JAVAVMS}; do
+ if [ ! -z "${JAVAVM}" ]; then
+ echo "${JAVAVM}" >> "${CONF}"
+ fi
+ done
+ fi
+ )
+
+ IFS="${ifs}"
+}
+
+#
+# Check all of the VMs in the configuration file
+#
+checkVMs () {
+ # Sort the configuration. This will also remove duplicates and
+ # non-existent VMs
+ sortConfiguration
+
+ # Ensure the configuration file exists
+ if [ ! -f "${CONF}" ]; then
+ exit 0
+ fi
+
+ # Ensure the configuration file has the correct permissions
+ if [ ! -w "${CONF}" -o ! -r "${CONF}" ]; then
+ echo "${IAM}: error: can't read/write ${CONF} configuration file!" 1>&2
+ exit 1
+ fi
+
+ # Ensure links are created for every executable for a VM.
+ cat "${CONF}" | \
+ (
+ while read JAVAVM; do
+ VM=`echo "${JAVAVM}" | sed -E 's|[[:space:]]*#.*||' 2>/dev/null`
+ # Create symbolic links as appropriate if they don't exist.
+ JAVA_HOME=`dirname "${VM}"`
+ JAVA_HOME=`dirname "${JAVA_HOME}"`
+ createJavaLinks "${JAVA_HOME}"
+ done;
+ )
+
+ exit 0
+}
+
+#
+# Register a new Java VM.
+#
registerVM () {
- if [ x"${1}" = x"" ]; then
- /bin/echo "Usage: ${IAM} path"
- exit
+ # Check the java command given to us.
+ if [ -z "${1}" ]; then
+ echo "Usage: ${IAM} path"
+ exit 1
fi
+ # Create the configuration file if it doesn't exist
if [ ! -e "${CONF}" ]; then
- /usr/bin/touch "${CONF}"
+ touch "${CONF}"
fi
- VM=`/bin/echo "${1}" | sed 's|#.*||'`
- if [ ! -x ${VM} ]; then
- /bin/echo "${IAM}: warning: the specified JavaVM \"${VM}\" either not exists or not executable" >&2
+ # Check that the given VM can be found in the configuration file
+ VM=`echo "${1}" | sed -E 's|[[:space:]]*#.*||' 2>/dev/null`
+ if [ ! -z "`grep "${VM}" "${CONF}"`" ]; then
+ echo "${IAM}: error: JavaVM \"${VM}\" is already registered" 1>&2
+ exit 1
fi
- /bin/ed "${CONF}" >/dev/null <<EOF
-0a
-${1}
-.
-w
-q
-EOF
+ # Check that the VM exists and is executable
+ if [ ! -e "${VM}" ]; then
+ echo "${IAM}: error: JavaVM \"${VM}\" does not exist" 1>&2
+ exit 1
+ fi
+ if [ ! -x "${VM}" ]; then
+ echo "${IAM}: error: JavaVM \"${VM}\" is not executable" 1>&2
+ exit 1
+ fi
+
+ # Add the VM to the configuration file
+ echo "${1}" >> "${CONF}"
+
+ # Create symbolic links as appropriate if they don't exist.
+ JAVA_HOME=`dirname "${VM}"`
+ JAVA_HOME=`dirname "${JAVA_HOME}"`
+ createJavaLinks "${JAVA_HOME}"
+
+ # Sort the VMs
+ sortConfiguration
+
exit 0
}
+#
+# Unregister a Java VM.
+#
unregisterVM () {
- if [ x"${1}" = x"" ]; then
- /bin/echo "Usage: ${IAM} path"
- exit
+ # Check usage
+ if [ -z "${1}" ]; then
+ echo "Usage: ${IAM} path"
+ exit 1
fi
+ # Check for the configuration file
if [ ! -e "${CONF}" ]; then
- /bin/echo "${IAM}: error: can't find ${CONF} config file!" >&2
+ echo "${IAM}: error: can't find ${CONF} configuration file!" >&2
exit 1
fi
- if [ x"`grep ${1} ${CONF}`" = x"" ]; then
- /bin/echo "${IAM}: error: \"${1}\" JavaVM is not currently registered"
+ # Check that the given VM can be found in the configuration file
+ if [ -z "`grep "${1}" "${CONF}"`" ]; then
+ echo "${IAM}: error: \"${1}\" JavaVM is not currently registered"
exit 1
fi
- /bin/ed "${CONF}" >/dev/null <<EOF
+ # Remove unneeded symlinks
+ VMS=`sed -E 's|[[:space:]]*#.*||' < "${CONF}" | uniq 2>/dev/null`
+ VM=`grep "${1}" "${CONF}" | sed -E 's|[[:space:]]*#.*||' 2>/dev/null`
+ JAVA_HOME=`dirname "${VM}"`
+ JAVA_HOME=`dirname "${JAVA_HOME}"`
+ for exe in "${JAVA_HOME}"/bin/* "${JAVA_HOME}"/jre/bin/*; do
+ exe=`basename "${exe}"`
+ if [ -L "${PREFIX}/bin/${exe}" -a \
+ "`realpath "${PREFIX}/bin/${exe}" 2>/dev/null `" = \
+ "${PREFIX}/bin/javavm" ]; then
+ for JAVAVM in ${VMS}; do
+ if [ "${JAVAVM}" != "${VM}" ]; then
+ JAVAVM=`dirname "${JAVAVM}"`
+ JAVAVM=`dirname "${JAVAVM}"`
+ if [ -x "${JAVAVM}/bin/${exe}" -o \
+ -x "${JAVAVM}/jre/bin/${exe}" ]; then
+ continue 2
+ fi
+ fi
+ done
+
+ rm "${PREFIX}/bin/${exe}"
+ fi
+ done
+
+ # Remove the VM from the configuration file
+ ed "${CONF}" >/dev/null <<EOF
g|${1}|d
w
q
EOF
- # Remove config file if its size reached 0
+ # Remove configuration file if its size reached 0
if [ ! -s "${CONF}" ]; then
- /bin/rm "${CONF}"
+ rm "${CONF}"
fi
exit 0
}
+# Check for an alias and call the appropriate function.
case "${IAM}" in
registervm )
registerVM "${1}"
@@ -93,29 +356,169 @@ case "${IAM}" in
unregistervm )
unregisterVM "${1}"
;;
+ checkvms )
+ checkVMs
+ ;;
esac
# Main ()
+# Backwards compatibility
+if [ "${IAM}" = "javavm" ]; then
+ echo "${IAM}: warning: The use of 'javavm' as a synonym for 'java' is deprecated" 1>&2
+ IAM=java
+fi
+
+# Use JAVA_HOME if its set in the environment
+if [ ! -z "${JAVA_HOME}" -a -x "${JAVA_HOME}/bin/${IAM}" ]; then
+ export JAVA_HOME
+ tryJavaCommand "${JAVA_HOME}/bin/${IAM}" "${@}"
+elif [ ! -z "${JAVA_HOME}" -a -x "${JAVA_HOME}/jre/bin/${IAM}" ]; then
+ export JAVA_HOME
+ tryJavaCommand "${JAVA_HOME}/jre/bin/${IAM}" "${@}"
+fi
+
unset JAVA_HOME
-# First check if JAVAVM environment variable is set
-if [ x"${JAVAVM}" != x"" ]; then
- tryrunVM "${JAVAVM}" "${@}"
+# Determine location of bsd.port.mk if it exists
+PORTSDIR=
+if [ -r /usr/share/mk/bsd.port.mk ]; then
+ PORTSDIR=`"${MAKE}" -f /usr/share/mk/bsd.port.mk -V PORTSDIR 2>/dev/null`
+fi
+
+BSD_PORT_MK=
+if [ ! -z "${PORTSDIR}" -a -r "${PORTSDIR}/Mk/bsd.port.mk" ]; then
+ BSD_PORT_MK="${PORTSDIR}/Mk/bsd.port.mk"
+fi
+
+# If bsd.port.mk was found, use that to determine the VM to use.
+if [ ! -z "${BSD_PORT_MK}" ]; then
+ JAVA_HOME=`"${MAKE}" -f "${BSD_PORT_MK}" -V JAVA_HOME USE_JAVA=yes 2>/dev/null`
+ if [ ! -z "${JAVA_HOME}" -a \
+ -x "${JAVA_HOME}/bin/${IAM}" ]; then
+ export JAVA_HOME
+ tryJavaCommand "${JAVA_HOME}/bin/${IAM}" "${@}"
+ elif [ ! -z "${JAVA_HOME}" -a \
+ -x "${JAVA_HOME}/jre/bin/${IAM}" ]; then
+ export JAVA_HOME
+ tryJavaCommand "${JAVA_HOME}/jre/bin/${IAM}" "${@}"
+ fi
fi
# Then try to make sure that ${CONF} exists
if [ ! -e "${CONF}" ]; then
- echo "${IAM}: error: can't find ${CONF} config file" >&2
+ echo "${IAM}: error: can't find ${CONF} configuration file" >&2
exit 1
fi
-# Allow coment in the ${CONF}
-VMS=`/usr/bin/sed 's|#.*||' < "${CONF}" | uniq`
+# Allow comments in the ${CONF}
+VMS=`sed -E 's|[[:space:]]*#.*||' < "${CONF}" | uniq 2>/dev/null`
+
+# Fix up JAVA_VERSION
+if [ ! -z "${JAVA_VERSION}" ]; then
+ VERSION=
+ for version in ${JAVA_VERSION}; do
+ case "${version}" in
+ 1.1+)
+ VERSION="${VERSION} 1.1 1.2 1.3 1.4"
+ ;;
+ 1.2+)
+ VERSION="${VERSION} 1.2 1.3 1.4"
+ ;;
+ 1.3+)
+ VERSION="${VERSION} 1.3 1.4"
+ ;;
+ 1.4+)
+ VERSION="${VERSION} 1.4"
+ ;;
+ *)
+ VERSION="${VERSION} ${version}"
+ ;;
+ esac
+ done
+ JAVA_VERSION=`echo "${VERSION}" | sort | uniq`
+fi
# Finally try to run one of the ${VMS}
for JAVAVM in ${VMS}; do
- tryrunVM "${JAVAVM}" "${@}";
+ JAVA_HOME=`dirname "${JAVAVM}"`
+ JAVA_HOME=`dirname "${JAVA_HOME}"`
+ VM=`basename "${JAVA_HOME}"`
+ # Respect JAVA_VERSION
+ if [ ! -z "${JAVA_VERSION}" ]; then
+ VERSION=`echo ${VM} | \
+ sed -e 's|[^0-9]*\([0-9]\)\.\([0-9]\)\.[0-9]|\1.\2|'`
+ for version in ${JAVA_VERSION}; do
+ if [ "${VERSION}" = "${version}" ]; then
+ VERSION=
+ break
+ fi
+ done
+ if [ ! -z "${VERSION}" ]; then
+ continue
+ fi
+ fi
+ # Respect JAVA_OS
+ if [ ! -z "${JAVA_OS}" ]; then
+ OS=
+ case "${VM}" in
+ diablo*|j*)
+ OS=native
+ ;;
+ linux*)
+ OS=linux
+ ;;
+ esac
+ for os in ${JAVA_OS}; do
+ if [ "${OS}" = "${os}" ]; then
+ OS=
+ break
+ fi
+ done
+ if [ ! -z "${OS}" ]; then
+ continue
+ fi
+ fi
+ # Respect JAVA_VENDOR
+ if [ ! -z "${JAVA_VENDOR}" ]; then
+ VENDOR=
+ case "${VM}" in
+ diablo*)
+ VENDOR=bsdjava
+ ;;
+ j*)
+ VENDOR=freebsd
+ ;;
+ linux-blackdown*)
+ VENDOR=blackdown
+ ;;
+ linux-ibm*)
+ VENDOR=ibm
+ ;;
+ linux-sun*)
+ VENDOR=sun
+ ;;
+ esac
+ for vendor in ${JAVA_VENDOR}; do
+ if [ "${VENDOR}" = "${vendor}" ]; then
+ VENDOR=
+ break
+ fi
+ done
+ if [ ! -z "${VENDOR}" ]; then
+ continue
+ fi
+ fi
+ # Check if the command exists and try to run it.
+ if [ ! -z "${JAVA_HOME}" -a \
+ -x "${JAVA_HOME}/bin/${IAM}" ]; then
+ export JAVA_HOME
+ tryJavaCommand "${JAVA_HOME}/bin/${IAM}" "${@}"
+ elif [ ! -z "${JAVA_HOME}" -a \
+ -x "${JAVA_HOME}/jre/bin/${IAM}" ]; then
+ export JAVA_HOME
+ tryJavaCommand "${JAVA_HOME}/jre/bin/${IAM}" "${@}"
+ fi
done
echo "${IAM}: error: no suitable JavaVMs found" >&2