You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Felix Dorner <FD...@zed.com> on 2009/04/21 10:59:46 UTC

Pass multiple directories to -lib option

Hey,

I tried several ways (space separated, semicolon-separated) to add more than one directory to the -lib option, somehow I cannot get this working (-diagnostics doesn't list my jars..). Thankful for any tips.

Felix

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Pass multiple directories to -lib option

Posted by Michael Ludwig <mi...@gmx.de>.
Peter Reilly schrieb am 23.04.2009 um 10:28:59 (+0100):
> I think that
> ant -f saxon.xml -lib C:\jlib
> should also work (untested).

Yes, it does, as per "ant -help". That seems to put on the classpath
whatever jars and classes are lying around in that directory.

> > ant -f saxon.xml -lib C:\jlib\saxon9-ant.jar -lib C:\jlib\saxon9.jar

Michael Ludwig

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Pass multiple directories to -lib option

Posted by Peter Reilly <pe...@gmail.com>.
I think that
ant -f saxon.xml -lib C:\jlib
should also work (untested).

Peter


On Wed, Apr 22, 2009 at 6:48 PM, Michael Ludwig <mi...@gmx.de> wrote:
> Felix Dorner schrieb am 22.04.2009 um 09:46:40 (+0200):
>>
>> > > The 'help' output and the manual say:
>> > >    "-lib <path>            specifies a path to search for jars and
>> > > classes"
>> > >
>> > > I had a look into the source code: the <path> is a real path: it is
>> > > tokenized by File.pathSeparator and each token is added to Ants
>> > > classpath.
>> >
>> > I didn't have a look into the source code, but tokenizing the
>> > path by the path seperator in order to add each token to the
>> > classpath wouldn't make any sense at all.
>> >
>> >   a/b/c -> a b c
>>
>> Make sure not to confuse File.separator and File.pathSeparator (Which
>> I guess caused a million hours of work in the Java World. Not happy
>> with those names..)
>
> Oops ... :-) Thanks for bringing this gotcha to my attention.
>
> This, however, doesn't work:
>
>  ant -f saxon.xml -lib C:\jlib\saxon9-ant.jar;C:\jlib\saxon9.jar
>
> Whereas this does:
>
>  ant -f saxon.xml -lib C:\jlib\saxon9-ant.jar -lib C:\jlib\saxon9.jar
>
> Michael Ludwig
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Pass multiple directories to -lib option

Posted by Michael Ludwig <mi...@gmx.de>.
Felix Dorner schrieb am 22.04.2009 um 09:46:40 (+0200):
> 
> > > The 'help' output and the manual say:
> > >    "-lib <path>            specifies a path to search for jars and
> > > classes"
> > > 
> > > I had a look into the source code: the <path> is a real path: it is 
> > > tokenized by File.pathSeparator and each token is added to Ants 
> > > classpath.
> > 
> > I didn't have a look into the source code, but tokenizing the 
> > path by the path seperator in order to add each token to the 
> > classpath wouldn't make any sense at all.
> > 
> >   a/b/c -> a b c
> 
> Make sure not to confuse File.separator and File.pathSeparator (Which
> I guess caused a million hours of work in the Java World. Not happy
> with those names..)

Oops ... :-) Thanks for bringing this gotcha to my attention.

This, however, doesn't work:

  ant -f saxon.xml -lib C:\jlib\saxon9-ant.jar;C:\jlib\saxon9.jar

Whereas this does:

  ant -f saxon.xml -lib C:\jlib\saxon9-ant.jar -lib C:\jlib\saxon9.jar

Michael Ludwig

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Pass multiple directories to -lib option

Posted by Felix Dorner <FD...@zed.com>.
> > The 'help' output and the manual say:
> >    "-lib <path>            specifies a path to search for jars and
> > classes"
> > 
> > I had a look into the source code: the <path> is a real path: it is 
> > tokenized by File.pathSeparator and each token is added to Ants 
> > classpath.
> 
> I didn't have a look into the source code, but tokenizing the 
> path by the path seperator in order to add each token to the 
> classpath wouldn't make any sense at all.
> 
>   a/b/c -> a b c

Make sure not to confuse File.separator and File.pathSeparator (Which I guess caused a million hours of work in the Java World. Not happy with those names..)

Felix

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Pass multiple directories to -lib option

Posted by Michael Ludwig <mi...@gmx.de>.
Jan.Materne@rzf.fin-nrw.de schrieb am 21.04.2009 um 11:17:18 (+0200):

> The 'help' output and the manual say:
>    "-lib <path>            specifies a path to search for jars and
> classes"
> 
> I had a look into the source code: the <path> is a real path: it is
> tokenized by File.pathSeparator and each token is added to Ants
> classpath.

I didn't have a look into the source code, but tokenizing the path by
the path seperator in order to add each token to the classpath wouldn't
make any sense at all.

  a/b/c -> a b c

That would produce three tokens, two of which probably inexistent as
directories. Nothing would work.

Michael Ludwig

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Pass multiple directories to -lib option

Posted by Felix Dorner <FD...@zed.com>.
> > So you mean it should work with ; (on Windows) separation
> and a single
> > -lib argument?
> yes, have you tried?

Yes I tried it, and once more right now. Doesn't work. Two possible sources of confusion:
 - Version issue, I use 1.7.0, but the one that's shipped with eclipse.
 - The directories that I use with multiple -lib options are nested. So this looks like:  -lib a -lib a\b  -lib a\c ...


Felix

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: Pass multiple directories to -lib option

Posted by Ja...@rzf.fin-nrw.de.
> So you mean it should work with ; (on Windows) separation and 
> a single -lib argument?
> Felix

yes, have you tried?

Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Pass multiple directories to -lib option

Posted by Felix Dorner <FD...@zed.com>.
Hi Jan,

> Use multiple -lib options
> $ant -lib one.jar -lib another.jar

Great! Thanks. Guess that was the only thing I didn't try...
 
> I had a look into the source code: the <path> is a real path: 
> it is tokenized by File.pathSeparator and each token is added 
> to Ants classpath.

So you mean it should work with ; (on Windows) separation and a single -lib argument?
Felix
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: Pass multiple directories to -lib option

Posted by Ja...@rzf.fin-nrw.de.
> I tried several ways (space separated, semicolon-separated) 
> to add more than one directory to the -lib option, somehow I 
> cannot get this working (-diagnostics doesn't list my 
> jars..). Thankful for any tips.

Use multiple -lib options
$ant -lib one.jar -lib another.jar

The 'help' output and the manual say:
   "-lib <path>            specifies a path to search for jars and
classes"

I had a look into the source code: the <path> is a real path: it is
tokenized by
File.pathSeparator and each token is added to Ants classpath.


Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org