Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jun 2002 17:17:35 -0700 (PDT)
From:      "Shelton C. Johnson Jr. <Shelton C. Johnson Jr." <shelton_c_j@yahoo.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/39080: java/javavmwrapper: Functionality enhancement
Message-ID:  <200206100017.g5A0HZZA094191@www.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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 <<EOF
 0a      

begin 644 javavm-patch.uu
M26YD97@Z(&IA=F%V;7=R87!P97(O<W)C+VIA=F%V;7=R87!P97(N<V@*/3T]
M/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]/3T]
M/3T]/3T]/3T]/3T]/3T]/3T]/0I20U,@9FEL93H@+VAO;64O;F-V<R]P;W)T
M<R]J879A+VIA=F%V;7=R87!P97(O<W)C+VIA=F%V;7=R87!P97(N<V@L=@IR
M971R:65V:6YG(')E=FES:6]N(#$N-PID:69F("UR,2XW(&IA=F%V;7=R87!P
M97(N<V@*,C5A,C8L,CD*/B`C($-O;7!U=&4@)$I!5D%?2$]-12]B:6X@9G)O
M;2`D2D%605](3TU%+V)I;B]J879A("AA:V$@)#$I"CX@(R!,;V]K(&9O<B`D
M24%-(&EN('1H870@9&ER96-T;W)Y"CX@(R!)9B!I="!I<R!P<F5S96YT+"!R
M=6X@:70@=VET:"!*059!7TA/344@<V5T(&%P<')O<')I871E;'D@86YD(&%L
M;"!O=&AE<B!A<F=S"CX@(R!)9B!T:&ES(&9A:6QS(&9A;&P@8F%C:R!T;R!T
M:&4@;VQD(&QO9VEC+B`@5&AI<R!S:&]U;&1N)W0@:&%P<&5N+@HR-V,S,2PS
M-PH\("`@("!I9B!;("UX("(D>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>'!O<G0@2D%605](3TU%"CX@("`@(&EF(%L@+7@@(B1[
M2F)I;GTO)'M)04U](B!=.R!T:&5N"CX@"7-H:69T"CX@"65X96,@(B1[2F)I
M;GTO)'M)04U](B`D>T!]"CX@("`@(&5L:68@6R`M>"`B)'LQ?2(@73L@=&AE
M;@HT-F,U-@H\("`@("`@("`@+V)I;B]E8VAO("(D>TE!37TZ('=A<FYI;F<Z
M('1H92!S<&5C:69I960@2F%V859-(%PB)'M637U<(B!E:71H97(@;F]T(&5X
M:7-T<R!O<B!N;W0@97AE8W5T86)L92(@/B8R"BTM+0H^("`@("`@("`@+V)I
M;B]E8VAO("(D>TE!37TZ('=A<FYI;F<Z('1H92!S<&5C:69I960@2F%V859-
M(%PB)'M637U<(B!E:71H97(@9&]E<R!N;W0@97AI<W0@;W(@:7,@;F]T(&5X
M96-U=&%B;&4B(#XF,@HT-V$U."PW,0H^("`@("`C($QO8V%T92!A;&P@<WEM
M8F]L:6,@;&EN:W,@:6X@=&AE("1*059!7TA/344O8FEN(&1I<F5C=&]R>2!F
M;W(@=&AE(`H^("`@("`C(&YE=R!*5DTN("!)9B!T:&5Y(&1O;B=T(&%L<F5A
M9'D@97AI<W0@:6X@)%!2149)6"]B:6XL(&-R96%T92!S>6UB;VQI8PH^("`@
M("`C(&QI;FMS(&9O<B!T:&5M('1O(&IA=F%V;2!I;B`D4%)%1DE8+V)I;BX@
M(%1H:7,@;&5T<R!T;V]L<R!L:6ME(&IA<BP@"CX@("`@(",@87!P;&5T=FEE
M=V5R+"!R;6EC(&%L;"!W;W)K(&%S(&5X<&5C=&5D+@H^("`@("!C9"`D4%)%
M1DE8+V)I;@H^("`@("!*8FEN/6!D:7)N86UE("(D>S%](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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206100017.g5A0HZZA094191>