You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2002/05/17 00:28:08 UTC

DO NOT REPLY [Bug 9183] New: - Make a reasonable guess about the JDK

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9183>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9183

Make a reasonable guess about the JDK

           Summary: Make a reasonable guess about the JDK
           Product: Ant
           Version: 1.4.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Wrapper scripts
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: danfuzz@milk.com


Ant likes JAVA_HOME to be set, but with the following small addition to the
wrapper script, it can make a reasonable guess about it. I am only familiar
with Sun's JDKs, but I imagine that the same general technique can be used to
for other vms.

oldwd=`pwd`
jpath=`which javac 2>/dev/null`
if [ -n "$jpath" ]; then
    cd `dirname $jpath`/..
    if [ -r "lib/tools.jar" -o -r "lib/classes.zip" ]; then
        # looks like a Sun JDK
        JAVA_HOME=`pwd`
    fi
fi
cd $oldwd

Thanks for listening.

-dan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>