From owner-freebsd-ports Sun Jun 9 17:20:16 2002 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id BE4D637B407 for ; Sun, 9 Jun 2002 17:20:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g5A0K1v55071; Sun, 9 Jun 2002 17:20:01 -0700 (PDT) (envelope-from gnats) Received: from nwww.freebsd.org (www.FreeBSD.org [216.136.204.117]) by hub.freebsd.org (Postfix) with ESMTP id 2E1ED37B403 for ; Sun, 9 Jun 2002 17:17:35 -0700 (PDT) Received: from www.freebsd.org (localhost [127.0.0.1]) by nwww.freebsd.org (8.12.2/8.12.2) with ESMTP id g5A0HZhG094192 for ; Sun, 9 Jun 2002 17:17:35 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.2/8.12.2/Submit) id g5A0HZZA094191; Sun, 9 Jun 2002 17:17:35 -0700 (PDT) Message-Id: <200206100017.g5A0HZZA094191@www.freebsd.org> Date: Sun, 9 Jun 2002 17:17:35 -0700 (PDT) From: "Shelton C. Johnson Jr. To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: ports/39080: java/javavmwrapper: Functionality enhancement Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 39080 >Category: ports >Synopsis: java/javavmwrapper: Functionality enhancement >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Jun 09 17:20:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Shelton C. Johnson Jr. >Release: FreeBSD 4.6-PRERELEASE i386 >Organization: Quantum Objects >Environment: FreeBSD titanium.digitalmagic.dnsq.org 4.6-PRERELEASE FreeBSD 4.6-PRERELEASE #3: Sat May 11 23:57:38 EDT 2002 kroot@titanium.digitalmagic.dnsq.org:/usr/obj/usr/src/sys/TITANIUM i386 >Description: Javavmwrapper provides a convenient mechanism to support multiple JVMs on one system and invoke them through a common script named javavm. This limits it to running only the core 'java' executable from the JVM. Many packages need access to other utilities provided with the JDK such as javac, jar, rmic etc. Through the creation of additional symbolic links in $PREFIX/bin which correspond to those in $JAVA_HOME/bin, this tool can be extended to allow access to those additonal utilities. For example /usr/local/jdk1.3.1/bin contains 44 different executables which are actually symbolic links to the same .java_wrapper script. This patch will extend the functionality of javavmwrapper to include all of the above executables. This patch also sets JAVA_HOME to match the chosen JVM just before launching the utility. This patch does not update the packing list for the port to reflect the additional links created when a JVM is registered through registervm. >How-To-Repeat: Just use javavm. Unless you explicitly add /usr/local/jdk1.3.1/bin to your path you will be unable to invoke java, javac, jar or other standard tools. The javavm script will only invoke java and is not very transparent to scripts and other tools looking for 'java'. >Fix: Apply the following patch. Provided both as a unified diff and a uuencoded version of the same. cvs diff: Diffing javavmwrapper cvs diff: Diffing javavmwrapper/src Index: javavmwrapper/src/javavmwrapper.sh =================================================================== RCS file: /home/ncvs/ports/java/javavmwrapper/src/javavmwrapper.sh,v retrieving revision 1.7 diff -u -r1.7 javavmwrapper.sh --- javavmwrapper/src/javavmwrapper.sh 2 Feb 2002 22:24:20 -0000 1.7 +++ javavmwrapper/src/javavmwrapper.sh 9 Jun 2002 22:03:13 -0000 @@ -23,8 +23,18 @@ CONF="${PREFIX}/etc/javavms" IAM=`basename "${0}"` +# Compute $JAVA_HOME/bin from $JAVA_HOME/bin/java (aka $1) +# Look for $IAM in that directory +# If it is present, run it with JAVA_HOME set appropriately and all other args +# If this fails fall back to the old logic. This shouldn't happen. tryrunVM () { - if [ -x "${1}" ]; then + Jbin=`dirname "${1}"` + JAVA_HOME=`dirname $Jbin` + export JAVA_HOME + if [ -x "${Jbin}/${IAM}" ]; then + shift + exec "${Jbin}/${IAM}" ${@} + elif [ -x "${1}" ]; then exec "${@}" fi @@ -43,8 +53,22 @@ VM=`/bin/echo "${1}" | sed 's|#.*||'` if [ ! -x ${VM} ]; then - /bin/echo "${IAM}: warning: the specified JavaVM \"${VM}\" either not e xists or not executable" >&2 + /bin/echo "${IAM}: warning: the specified JavaVM \"${VM}\" either does not exist or is not executable" >&2 fi + # Locate all symbolic links in the $JAVA_HOME/bin directory for the + # new JVM. If they don't already exist in $PREFIX/bin, create symbolic + # links for them to javavm in $PREFIX/bin. This lets tools like jar, + # appletviewer, rmic all work as expected. + cd $PREFIX/bin + Jbin=`dirname "${1}"` + for i in $Jbin/* + do + Jtool=`basename $i` + if [ -h $i -a ! -e $PREFIX/bin/$Jtool ] + then + ln -s javavm $Jtool + fi + done /bin/ed "${CONF}" >/dev/null <S%](B!=.R!T:&5N"BTM+0H^("`@("!*8FEN M/6!D:7)N86UE("(D>S%](F`*/B`@("`@2D%605](3TU%/6!D:7)N86UE("1* M8FEN8`H^("`@("!E>'!OT!]"CX@("`@(&5L:68@6R`M>"`B)'LQ?2(@73L@=&AE M;@HT-F,U-@H\("`@("`@("`@+V)I;B]E8VAO("(D>TE!37TZ('=ATE!37TZ('=A2!F M;W(@=&AE(`H^("`@("`C(&YE=R!*5DTN("!)9B!T:&5Y(&1O;B=T(&%L6UB;VQI8PH^("`@ M("`C(&QI;FMS(&9OS%](F`*/B`@("`@9F]R M(&D@:6X@)$IB:6XO*@H^(`ED;PH^(`E*=&]O;#U@8F%S96YA;64@)&E@"CX@ M"6EF(%L@+6@@)&D@+6$@(2`M92`D4%)%1DE8+V)I;B\D2G1O;VP@70H^(`D) L=&AE;@H^(`D);&X@+7,@:F%V879M("1*=&]O;`H^(`D)9FD*/B`)9&]N90H` ` end >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message