1*946379e7Schristos#!/bin/sh 2*946379e7Schristos# Execute a Java program. 3*946379e7Schristos 4*946379e7Schristos# Copyright (C) 2001, 2006 Free Software Foundation, Inc. 5*946379e7Schristos# Written by Bruno Haible <haible@clisp.cons.org>, 2001. 6*946379e7Schristos# 7*946379e7Schristos# This program is free software; you can redistribute it and/or modify 8*946379e7Schristos# it under the terms of the GNU General Public License as published by 9*946379e7Schristos# the Free Software Foundation; either version 2, or (at your option) 10*946379e7Schristos# any later version. 11*946379e7Schristos# 12*946379e7Schristos# This program is distributed in the hope that it will be useful, 13*946379e7Schristos# but WITHOUT ANY WARRANTY; without even the implied warranty of 14*946379e7Schristos# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*946379e7Schristos# GNU General Public License for more details. 16*946379e7Schristos# 17*946379e7Schristos# You should have received a copy of the GNU General Public License 18*946379e7Schristos# along with this program; if not, write to the Free Software Foundation, 19*946379e7Schristos# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20*946379e7Schristos 21*946379e7Schristos# This uses the same choices as javaexec.c, but instead of relying on the 22*946379e7Schristos# environment settings at run time, it uses the environment variables 23*946379e7Schristos# present at configuration time. 24*946379e7Schristos# 25*946379e7Schristos# This is a separate shell script, because it must be able to unset JAVA_HOME 26*946379e7Schristos# in some cases, which a simple shell command cannot do. 27*946379e7Schristos# 28*946379e7Schristos# The extra CLASSPATH must have been set prior to calling this script. 29*946379e7Schristos 30*946379e7SchristosCONF_JAVA='@CONF_JAVA@' 31*946379e7SchristosCONF_CLASSPATH='@CLASSPATH@' 32*946379e7Schristosif test -n "@HAVE_JAVA_ENVVAR@"; then 33*946379e7Schristos # Combine given CLASSPATH and configured CLASSPATH. 34*946379e7Schristos if test -n "$CLASSPATH"; then 35*946379e7Schristos CLASSPATH="$CLASSPATH${CONF_CLASSPATH:+@CLASSPATH_SEPARATOR@$CONF_CLASSPATH}" 36*946379e7Schristos else 37*946379e7Schristos CLASSPATH="$CONF_CLASSPATH" 38*946379e7Schristos fi 39*946379e7Schristos export CLASSPATH 40*946379e7Schristos test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@" 41*946379e7Schristos exec $CONF_JAVA "$@" 42*946379e7Schristoselse 43*946379e7Schristos unset JAVA_HOME 44*946379e7Schristos export CLASSPATH 45*946379e7Schristos if test -n "@HAVE_GIJ@"; then 46*946379e7Schristos # In this case, $CONF_JAVA is "gij". 47*946379e7Schristos test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@" 48*946379e7Schristos exec $CONF_JAVA "$@" 49*946379e7Schristos else 50*946379e7Schristos if test -n "@HAVE_JAVA@"; then 51*946379e7Schristos # In this case, $CONF_JAVA is "java". 52*946379e7Schristos test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@" 53*946379e7Schristos exec $CONF_JAVA "$@" 54*946379e7Schristos else 55*946379e7Schristos if test -n "@HAVE_JRE@"; then 56*946379e7Schristos # In this case, $CONF_JAVA is "jre". 57*946379e7Schristos test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@" 58*946379e7Schristos exec $CONF_JAVA "$@" 59*946379e7Schristos else 60*946379e7Schristos if test -n "@HAVE_JVIEW@"; then 61*946379e7Schristos # In this case, $CONF_JAVA is "jview". 62*946379e7Schristos test -z "$JAVA_VERBOSE" || echo "$CONF_JAVA $@" 63*946379e7Schristos exec $CONF_JAVA "$@" 64*946379e7Schristos else 65*946379e7Schristos echo 'Java virtual machine not found, try installing gij or set $JAVA, then reconfigure' 1>&2 66*946379e7Schristos exit 1 67*946379e7Schristos fi 68*946379e7Schristos fi 69*946379e7Schristos fi 70*946379e7Schristos fi 71*946379e7Schristosfi 72