Hi,
The Sun JVM does a really poor job of dealing with quotes in arguments. One
way you can get around this is to wrap your double-quoted arg in
single-quotes.
For example, in the following:
> Commandline commandLine = new Commandline();
> commandLine.setExecutable("cmdclient");
> commandLine.createArgument().setValue("-user");
> commandLine.createArgument().setValue("\"integrator\"");
replace the last line with
commandLine.createArgument().setValue("\'\"integrator\"\'");
This works for Sun JVMs on Windows. Don't know about other platforms or
JVMs.
Perhaps a better option is to fix the executable to behave a little better
as a command-line tool. Or write a wrapper script.
Adam
> -----Original Message-----
> From: Natalia Bello [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 6 March 2002 12:56 AM
> To: 'Ant Users List'
> Subject: Own task. Commandline
>
>
> Hello!
> I am trying to develop my own task; in this task I need to
> execute a command
> line like this:
> cmdclient -user "integrator" -pass "password" ..
> that is, i need to set the arguments between double quotes!!
> I have tried some posibilites, but i havent success!
> If i try for example
> Commandline commandLine = new Commandline();
> commandLine.setExecutable("cmdclient");
> commandLine.createArgument().setValue("-user \"integrator\"");
> log("Executing " + commandLine.toString());
>
> I get:
> [CBL] Executing cmdclient '-user "integrator"'
>
> or this other
> Commandline commandLine = new Commandline();
> commandLine.setExecutable("cmdclient");
> commandLine.createArgument().setLine("-user
> \"integrator\"");
> log("Executing " + commandLine.toString());
> I get:
> [CBL] Executing cmdclient -user integrator
>
> or:
> Commandline commandLine = new Commandline();
> commandLine.setExecutable("cmdclient");
> commandLine.createArgument().setValue("-user");
> commandLine.createArgument().setValue("\"integrator\"");
> log("Executing " + commandLine.toString());
>
> I get again:
> [CBL] Executing cmdclient -user integrator
>
> Does anyone now how i can do this?
> Thanks in advanced,
> Natalia
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>