[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#103420: marked as done (Proposed addition to java-common)



Your message dated Fri, 23 Jan 2004 11:45:28 +1100
with message-id <20040123114528.A31849@digican.ms.unimelb.edu.au>
and subject line Abandoning proposed java-common addition
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 4 Jul 2001 02:35:31 +0000
>From benb@acm.org Tue Jul 03 21:35:31 2001
Return-path: <benb@acm.org>
Received: from hardy.math.okstate.edu [::ffff:139.78.112.2] 
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 15HcVm-0004W9-00; Tue, 03 Jul 2001 21:35:30 -0500
Received: from emerald (mail@x8b4e43fc.dhcp.okstate.edu [139.78.67.252])
	by hardy.math.okstate.edu (8.9.3/8.9.3) with ESMTP id VAA04617;
	Tue, 3 Jul 2001 21:28:39 -0500
Received: from emerald
	([127.0.0.1] helo=there ident=bab)
	by emerald with smtp (Exim 3.22 #1 (Debian))
	id 15HcVA-0006AA-00; Tue, 03 Jul 2001 21:34:52 -0500
Content-Type: text/plain;
  charset="iso-8859-1"
From: Ben Burton <benb@acm.org>
To: debian-java@lists.debian.org
Subject: Proposed addition to java-common
Date: Tue, 3 Jul 2001 21:34:49 -0500
X-Mailer: KMail [version 1.2.9]
Cc: submit@bugs.debian.org
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Message-Id: <E15HcVA-0006AA-00@emerald>
Delivered-To: submit@bugs.debian.org


Package: java-common
Severity: wishlist

Hi.  Policy states that Java programs must run without specific environment 
variables, which can be some hassle when writing a program that works with 
several JVMs.  Different JVMs use different bootstrap classes - which 
sometimes need to be passed on the command line (eg. kaffe) - and often even 
have different binaries for execution (/usr/bin/java, /usr/bin/kaffe, etc).

I have written a script that will try to guess which command to use for the 
java runtime and which bootstrap classes need to be passed on the command 
line.  It does this by trying some standards commands (java, kaffe, etc).  
When it finds one that works, it runs it to get version information; from 
that it determines which JVM is being used and from there works out what 
bootstrap classes to pass.  All decisions it makes can be manually overridden 
by setting the appropriate environment variables (although the entire point 
is that you don't *need* to set such variables and everything should still 
work).

I've only tested blackdown and kaffe (japhar won't even run on my system) but 
it should be relatively straightforward to add other JVMs to the recognition 
list.

My proposal is that this script be included in java-common, since in theory 
it could be used to create a runtime script for almost every java program 
that is packaged.  I currently have it on my system as /usr/bin/find_java.

If this is accepted for java-common, I will happily write a full man page to 
go with it.  There is also a /usr/bin/find_javac in the works with the 
obvious alternate goal.

The script /usr/bin/find_java is included below.

Ben.


#!/bin/sh
set -e

# find_java - Script utilities for guessing Java runtime and classpath
#
# Copyright (c) 2001 Ben Burton <benb@acm.org>
# Written for Debian GNU/Linux
# Released under LGPL
#
# Usage: find_java [ --eval | --print ]
#
# --eval:
#     Writes a shell command to standard output that can be slurped into
#     another script using eval.  The output will look like:
#
#         JVM="funky" ;
#         JAVA="chickens" ;
#         BOOTSTRAP_CLASSES="dance"
#
#     The following line in your own script will thus call this script
#     and set the corresponding variables in your script:
#
#         eval `find_java --eval`
#
# --print:
#     Writes its guesses to standard output in human-readable form.
#
# $JAVA will be set to the command that starts the Java interpreter
# (such as /usr/bin/java).
#
# $JVM will be set to a token describing which particular Java virtual machine
# is called by $JAVA.  Tokens that are currently returned are listed
# below.
#
# $BOOTSTRAP_CLASSES will be set to the part of the classpath
# containing the core Java classes.  This will be left empty if $JAVA
# does not require this part of the classpath to be specified.
#
# If any of these variables are already set in the environment, the
# values from the environment will be used.
#
# This script is not guaranteed to work; it merely makes educated
# guesses.  It should work for all the JVMs distributed with Debian.
#
# Exit status: 0 on success, 1 if no intelligent guesses could be made.
#
# JVM tokens:
#     blackdown: Blackdown port of the Sun Java runtime
#     kaffe: Kaffe virtual machine from Transvirtual
#     unknown: Some other JVM

case "$1" in
	--eval )
	;;
	--print )
	;;
	* )
		echo "Usage: $0 [ --eval | --print ]"
		echo "See comments at the beginning of this script for further details."
		exit 1
	;;
esac

# Determine the java runtime command.
if [ -z "$JAVA" ]; then
	# Check for common JVMs.
	if which java >& /dev/null; then
		JAVA=`which java`
	elif which kaffe >& /dev/null; then
		JAVA=`which kaffe`
	else
		echo "Cannot locate a Java virtual machine."
		echo
		echo "Set the environment variable \$JAVA to the command that starts"
		echo "your Java interpreter (such as /usr/bin/java) and try again."
		echo
		exit 1
	fi
	export JAVA
fi

# Determine whose JVM we are using.
if ! version=`"$JAVA" -version 2>&1`; then
	version=
fi
case "$version" in
	# Search for a string not included in $JAVA so we don't accidentally
	# catch output such as "kaffe: Command not found" and the like.
	*[Tt]ransvirtual* )
		JVM=kaffe
	;;
	*[Bb]lackdown* )
		JVM=blackdown
	;;
	* )
		# No idea.
		JVM=unknown
	;;
esac

# Determine the bootstrap classes.
if [ -z "$BOOTSTRAP_CLASSES" ]; then
	case "$JVM" in
		kaffe )
			if [ -e /usr/share/kaffe/Klasses.jar ]; then
				kaffejars=`ls /usr/share/kaffe/*.jar`
				BOOTSTRAP_CLASSES=`echo $kaffejars | tr ' ' ':'`
			else
				echo "The core Kaffe classes could not be found."
				echo
				echo "Set the environment variable \$BOOTSTRAP_CLASSES to a"
				echo "colon-separated list of jars containing the core Kaffe"
				echo "classes (such as /usr/share/kaffe/Klasses.jar) and try again."
				echo
				exit 1
			fi
		;;
		blackdown )
			# Don't need to specify bootstrap classes.
			BOOTSTRAP_CLASSES=
		;;
		* )
			# Let's hope we have a JVM that automagically knows where its
			# bootstrap classes are.
			BOOTSTRAP_CLASSES=
		;;
	esac
	export BOOTSTRAP_CLASSES
fi

case "$1" in
	--eval )
		echo "JVM=\"$JVM\" ;"
		echo "JAVA=\"$JAVA\" ;"
		echo "BOOTSTRAP_CLASSES=\"$BOOTSTRAP_CLASSES\""
	;;
	--print )
		echo "JVM: $JVM"
		echo "Runtime: $JAVA"
		echo "Bootstrap classes: $BOOTSTRAP_CLASSES"
	;;
esac



---------------------------------------
Received: (at 103420-close) by bugs.debian.org; 23 Jan 2004 00:46:04 +0000
>From bab@debian.org Thu Jan 22 16:46:04 2004
Return-path: <bab@debian.org>
Received: from digican.ms.unimelb.edu.au [128.250.24.201] 
	by spohr.debian.org with esmtp (Exim 3.35 1 (Debian))
	id 1AjpSW-0006ct-00; Thu, 22 Jan 2004 16:46:04 -0800
Received: by digican.ms.unimelb.edu.au (Postfix, from userid 609)
	id 100DF7C04E; Fri, 23 Jan 2004 11:45:28 +1100 (EST)
Date: Fri, 23 Jan 2004 11:45:28 +1100
From: Ben Burton <bab@debian.org>
To: 103420-close@bugs.debian.org
Subject: Abandoning proposed java-common addition
Message-ID: <20040123114528.A31849@digican.ms.unimelb.edu.au>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2.5.1i
Delivered-To: 103420-close@bugs.debian.org
X-Spam-Checker-Version: SpamAssassin 2.60-bugs.debian.org_2004_01_20 
	(1.212-2003-09-23-exp) on spohr.debian.org
X-Spam-Status: No, hits=0.0 required=4.0 tests=none autolearn=no 
	version=2.60-bugs.debian.org_2004_01_20
X-Spam-Level: 


This proposed addition to java-common is two and a half years old, well
out of date and several better proposals have come forwards since.  It
makes sense then to close this bug.

Ben.



Reply to: