Yes, I happened to sort it out, thanks.

Daniel

--------------------------------------------------
From: "Siegfried Goeschl" <[email protected]>
Sent: Monday, April 19, 2010 7:04 PM
To: "Commons Users List" <[email protected]>
Subject: Re: Commons Exec not producing the same result as the command line

Hi Daniel,

any progress and/or information regarding your problem?

Cheers,

Siegfried Goeschl

On 14.04.10 11:54, Daniel Wamara wrote:
I did make a wrapper, that's the script I am calling from the exec and
even calling the wrapper through exec, I get the same thing I get when I
use no wrapper. It's very unlikely that another application is picked up
as it is the only instance of the application installed on the server (a
Red Hat EL 3).

Daniel

--------------------------------------------------
From: "sebb" <[email protected]>
Sent: Wednesday, April 14, 2010 11:46 AM
To: "Commons Users List" <[email protected]>
Subject: Re: Commons Exec not producing the same result as the command line

On 14/04/2010, Daniel Wamara <[email protected]> wrote:
Very unlikely IMO because they both call an external process which has
nothing to do with Java and if there was some kind of problem with
the path,
I think the external process would have thrown an error of some kind.

If the PATH is different, it may pick up a different application.

Do other Exec calls work OK?

Try creating a wrapper shell script with no parameters.
Call that interactively and from Exec.
Add debug echo statements as necessary to determine what is happening.

Regards,
Daniel W.

--------------------------------------------------
From: "sebb" <[email protected]>
Sent: Wednesday, April 14, 2010 11:36 AM

To: "Commons Users List" <[email protected]>
Subject: Re: Commons Exec not producing the same result as the
command line


> On 14/04/2010, sebb <[email protected]> wrote:
>
> > On 14/04/2010, Daniel Wamara <[email protected]> wrote:
> > > Thanks but I don't think this will help solve the problem as I > > > can
see in
> > > the log that the command which is executed is the correct one
and > > as
said,
> > > copy-pasting the command seen in the logs is producing a file
completely
> > > different than the one created by Commons Exec.
> >
> >
> > Then the two invocations are most likely using different
classpaths > > at
> > some point.
> >
>
> ... I mean PATHs.
>
>
> >
> > > Regards,
> > > Daniel W.
> > >
> > > --------------------------------------------------
> > > From: "sebb" <[email protected]>
> > > Sent: Wednesday, April 14, 2010 1:18 AM
> > > To: "Commons Users List" <[email protected]>
> > > Subject: Re: Commons Exec not producing the same result as the
command line
> > >
> > >
> > > >
> > > > On 13/04/2010, Daniel Wamara <[email protected]> wrote:
> > > >
> > > > > Good evening all,
> > > > >
> > > > > I am trying to call ffmpeg via the command exec in order to
transcode
> > > some files and the strange thing happening is that the files >
> produced
are
> > > not the same as the one I can create when calling the same > > > command
via the
> > > command line.
> > > > >
> > > > > This is how I am calling fmpeg and I get a file with a
particular codec
> > > in it (strangely not the right one) although launching in the >
> command
line
> > > exactly what I have in the sb.toString() which is the command
to > > be
> > > executed, the file created has a correct codec. So to say, the
> > same
command
> > > started via Exec and the one started via the command line have > > > not
the same
> > > result. Anyone has an idea?
> > > > >
> > > > > Thanks.
> > > > > Daniel Wamara
> > > > >
> > > > > StringBuilder sb = new
> > > StringBuilder("/home/ect/scripts/transcoding.sh ");
> > > > >
> > > > > sb.append(" " + source.getAbsolutePath());
> > > > >
> > > > > sb.append(" " + attributes.getCodec());
> > > > >
> > > > > sb.append(" " +
> > >
String.valueOf(attributes.getSamplingRate().intValue()));
> > > > >
> > > > > sb.append(" " + target.getAbsolutePath());
> > > > >
> > > > >
> > > > > logDebug("command --> " + sb.toString());
> > > > >
> > > > >
> > > > > CommandLine commandLine =
> > > CommandLine.parse(sb.toString());
> > > > >
> > > >
> > > > Why do you build up the command-line and then parse it?
> > > >
> > > > Much safer to add the arguments one at a time, see:
> > > >
> > > > http://commons.apache.org/exec/tutorial.html
> > > >
> > > > under the heading "Build the Command Line Incrementally"
> > > >
> > > >
> > > >
> > > > > DefaultExecutor executor = new DefaultExecutor();
> > > > >
> > > > > executor.execute(commandLine);
> > > > >
> > > > >
> > > >
> > > >
> > >
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > [email protected]
> > > > For additional commands, e-mail: [email protected]
> > > >
> > > >
> > > >
> > >
> > >
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > [email protected]
> > > For additional commands, e-mail: [email protected]
> > >
> > >
> >
> >
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
[email protected]
> For additional commands, e-mail: [email protected]
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail:
[email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to