You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by gu...@stinky.com on 2001/07/20 19:04:32 UTC
[PATCH] add JAXP jars to classpath if possible
I just did a clean install of Ant. I like the concept of having an
executable "ant" installed in $ANT_HOME/bin. However, it does not
work right out of the box. It depends on the user having JAXP JARs in
their classpath. I am a strong believer in not forcing the user to
set their classpath any more than absolutely necessary -- it violates
the "no globals" philosophy of Java. (I've been burned by conflicting
versions of XML parser libraries many times. And using jre/lib/ext to
install extensions simply does not work, for some bizarre reason, for
many JARs.)
I'd like to propose that the "ant" script look for an environment
variable called "JAXP_HOME" and, if it's defined, add its "jaxp.jar"
and "crimson.jar" to LOCALCLASSPATH.
Here's a patch.
Index: ant
===================================================================
RCS file: /home/cvs/jakarta-ant/src/script/ant,v
retrieving revision 1.7
diff -u -r1.7 ant
--- ant 2001/07/07 16:29:49 1.7
+++ ant 2001/07/20 17:10:38
@@ -124,6 +124,12 @@
fi
fi
+# If JAXP_HOME is defined, then add JAXP JARs (to end of classpath, so
+# users can override with their own CLASSPATH)
+if [ "" != "$JAXP_HOME" ] ; then
+ LOCALCLASSPATH="$LOCALCLASSPATH:$JAXP_HOME/jaxp.jar:$JAXP_HOME/crimson.jar"
+fi
+
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
ANT_HOME=`cygpath --path --windows "$ANT_HOME"`
I'm not sure if I have committer access to jakarta-ant, but I'd be
happy to try if I get a thumbs up from this list.
--
Alex Chaffee mailto:alex@jguru.com
jGuru - Java News and FAQs http://www.jguru.com/alex/
Creator of Gamelan http://www.gamelan.com/
Founder of Purple Technology http://www.purpletech.com/
Curator of Stinky Art Collective http://www.stinky.com/
Re: [PATCH] add JAXP jars to classpath if possible
Posted by Peter Donald <do...@apache.org>.
If you prepend to LOCALCLASSPATH or check that LOCALCLASSPATHis defined
before using it then I would +1 the change ;)
On Sat, 21 Jul 2001 03:04, guru@stinky.com wrote:
> I just did a clean install of Ant. I like the concept of having an
> executable "ant" installed in $ANT_HOME/bin. However, it does not
> work right out of the box. It depends on the user having JAXP JARs in
> their classpath. I am a strong believer in not forcing the user to
> set their classpath any more than absolutely necessary -- it violates
> the "no globals" philosophy of Java. (I've been burned by conflicting
> versions of XML parser libraries many times. And using jre/lib/ext to
> install extensions simply does not work, for some bizarre reason, for
> many JARs.)
>
> I'd like to propose that the "ant" script look for an environment
> variable called "JAXP_HOME" and, if it's defined, add its "jaxp.jar"
> and "crimson.jar" to LOCALCLASSPATH.
>
> Here's a patch.
>
> Index: ant
> ===================================================================
> RCS file: /home/cvs/jakarta-ant/src/script/ant,v
> retrieving revision 1.7
> diff -u -r1.7 ant
> --- ant 2001/07/07 16:29:49 1.7
> +++ ant 2001/07/20 17:10:38
> @@ -124,6 +124,12 @@
> fi
> fi
>
> +# If JAXP_HOME is defined, then add JAXP JARs (to end of classpath, so
> +# users can override with their own CLASSPATH)
> +if [ "" != "$JAXP_HOME" ] ; then
> +
> LOCALCLASSPATH="$LOCALCLASSPATH:$JAXP_HOME/jaxp.jar:$JAXP_HOME/crimson.jar"
> +fi
> +
> # For Cygwin, switch paths to Windows format before running java
> if $cygwin; then
> ANT_HOME=`cygpath --path --windows "$ANT_HOME"`
>
>
> I'm not sure if I have committer access to jakarta-ant, but I'd be
> happy to try if I get a thumbs up from this list.
--
Cheers,
Pete
*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof." |
| - John Kenneth Galbraith |
*-----------------------------------------------------*
Re: [PATCH] add JAXP jars to classpath if possible
Posted by gu...@stinky.com.
On Fri, Jul 20, 2001 at 01:55:00PM -0400, Glenn McAllister wrote:
> guru@stinky.com wrote:
>
> > I just did a clean install of Ant. I like the concept of having an
> > executable "ant" installed in $ANT_HOME/bin. However, it does not
> > work right out of the box. It depends on the user having JAXP JARs in
> > their classpath.
>
> Err... the latest (1.4alpha) binary and source distribution have the JAXP 1.1
> jars in the lib directory, which will get picked up automatically when you run
> ant. The 1.3 binary and source distributions have the JAXP 1.0.1 jars in the lib
> directory.
>
> What exactly do you mean when you say you did a "clean install" of Ant?
My mistake. I installed the "dist" directory instead of the
"jakarta-ant-1.4alpha" directory after doing "build.sh dist". I guess
the "dist" directory is just temporary. Kind of misleading...
Sorry to bother you :-)
--
Alex Chaffee mailto:alex@jguru.com
jGuru - Java News and FAQs http://www.jguru.com/alex/
Creator of Gamelan http://www.gamelan.com/
Founder of Purple Technology http://www.purpletech.com/
Curator of Stinky Art Collective http://www.stinky.com/
Re: [PATCH] add JAXP jars to classpath if possible
Posted by Glenn McAllister <gl...@somanetworks.com>.
guru@stinky.com wrote:
> I just did a clean install of Ant. I like the concept of having an
> executable "ant" installed in $ANT_HOME/bin. However, it does not
> work right out of the box. It depends on the user having JAXP JARs in
> their classpath.
Err... the latest (1.4alpha) binary and source distribution have the JAXP 1.1
jars in the lib directory, which will get picked up automatically when you run
ant. The 1.3 binary and source distributions have the JAXP 1.0.1 jars in the lib
directory.
What exactly do you mean when you say you did a "clean install" of Ant?
> I'd like to propose that the "ant" script look for an environment
> variable called "JAXP_HOME" and, if it's defined, add its "jaxp.jar"
> and "crimson.jar" to LOCALCLASSPATH.
And what happens when the next version of JAXP comes along and crimson.jar gets
named blah.jar? The current method works better by my way of thinking.
Glenn McAllister
SOMA Networks, Inc.