We seem to be getting a lot of people trying to build ant and not
reading the build.sh file to see what the problem might be when it
can't find sun.tools.* classes.

This patch only affects the Unix files as I dont know how to make the
changes for windows.

All it does it print a warning if JAVA_HOME is not set, I dont know of
a better way to do this other than using grep to see if tools.jar or
classes.zip is already in the classpath.

I patched both bootstrap.sh and ant.

I've also updated the README file to explicitly list the build and
install links of the documentation so people know what steps are
needed to build ant.  

I've updated index.html to include setting the JAVA_HOME variable for
the build process and added a link to the installing process to show
how this is done for your operating system.

The only caveat with this patch is that people are unlikely to read
the warning output :) but at least its there.

Barrie
--
Barrie Treloar
____________________________________________________________________

  Barrie Treloar                      Phone: +61 8 8303 3300
  Senior Analyst/Programmer           Fax:   +61 8 8303 4403 
  Electronic Commerce Division        Email: [EMAIL PROTECTED]
  Camtech (SA) Pty Ltd                http://www.camtech.com.au
 --- Level 8, 10 Pulteney Street, Adelaide SA 5000, Australia. ---
____________________________________________________________________

--- README      Fri Jul 28 09:11:05 2000
+++ README.new  Fri Jul 28 09:43:41 2000
@@ -53,6 +53,8 @@
   -------------
 
   Documentation is available in HTML format, in the docs/ directory.
+  For building see docs/index.html#buildingant.
+  For installing see docs/index.html#installing.
 
 
   Licensing
--- index.html  Fri Jul 28 09:11:16 2000
+++ index.html.new      Fri Jul 28 09:48:28 2000
@@ -107,6 +107,9 @@
 <h2><a name="buildingant">Building Ant</a></h2>
 <p>Go to the directory <code>jakarta-ant</code>.</p>
 <p>Make sure the JDK is in you path.</p>
+<p>Set the JAVA_HOME environment variable. This should be set to the
+directory where the JDK is installed. See <a href="#installing">Installing 
Ant</a>
+for examples on how to do this for your operating system.</p>
 <p>Run <code>bootstrap.bat</code> (Windows) or <code>bootstrap.sh</code> (UNIX)
 to build a bootstrap version of Ant.</p>
 <p>When finished, use</p>
--- bootstrap.sh        Fri Jul 28 09:11:06 2000
+++ bootstrap.sh.new    Fri Jul 28 09:25:29 2000
@@ -19,12 +19,19 @@
   CLASSPATH=$LOCALCLASSPATH
 fi
 
-if test -f $JAVA_HOME/lib/tools.jar ; then
-  CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar
-fi
+if [ "$JAVA_HOME" != "" ] ; then
+  if test -f $JAVA_HOME/lib/tools.jar ; then
+    CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar
+  fi
 
-if test -f $JAVA_HOME/lib/classes.zip ; then
-  CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/classes.zip
+  if test -f $JAVA_HOME/lib/classes.zip ; then
+    CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/classes.zip
+  fi
+else
+  echo "Warning: JAVA_HOME environment variable not set."
+  echo "  If build fails because sun.* classes could not be found"
+  echo "  you will need to set the JAVA_HOME environment variable"
+  echo "  to the installation directory of java."
 fi
 
 TOOLS=src/main/org/apache/tools
--- src/bin/ant Fri Jul 28 09:11:22 2000
+++ src/bin/ant.new     Fri Jul 28 09:27:27 2000
@@ -51,6 +51,11 @@
   if test -f $JAVA_HOME/lib/classes.zip ; then
     LOCALCLASSPATH=$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip
   fi
+else
+  echo "Warning: JAVA_HOME environment variable not set."
+  echo "  If build fails because sun.* classes could not be found"
+  echo "  you will need to set the JAVA_HOME environment variable"
+  echo "  to the installation directory of java."
 fi
 
 $JAVACMD -classpath $LOCALCLASSPATH -Dant.home=${ANT_HOME} $ANT_OPTS 
org.apache.tools.ant.Main $@

Reply via email to