2010/3/5 Glynn Clements <[email protected]>

>
> maven apache wrote:
>
> > Hi, thanks for your detailed reply.
> > And I have write a java class according to your instruction,however it
> can
> > not give the right output.
>
> What output does it give?
>
> > I test with the spearfish60 data and the
> > r.infoprocess.
> > Attach my code, can you check it ?
>
> >       public String run(String cmd)    {
>
> >               try {
> >                       cmd="/bin/sh -c " + cmd;
> >                       String[] exe={"/bin/sh -c",cmd};
>
> >                       Process p1=rt.exec(exe,env);
>
> I suggest that you don't use the shell; it just makes life harder.
> Instead, define:
>
>        public String run(String[] cmd)  {
>        ...
>                        Process p1=rt.exec(cmd, env);
>
> and use:
>
>        gm.run({"r.info", "map=roads"});
>
> --
>
Hi, I use the following:

public String run(String[] cmd)  {
    String[] exe = { "bash", "-c", cmd };
    Process p1=rt.exec(exe, env);
...

Now it works, thank you anyway! I can not make it work without your patient
explanation these days! Your are a good guy!

Also, I want to say "Thank you" to everyone who have help me complete my
job.! :)

Glynn Clements <[email protected]>
>
_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to