[GRASS-user] grass shell

maven apache apachemaven0 at gmail.com
Fri Mar 5 01:18:22 EST 2010


2010/3/5 Glynn Clements <glynn at gclements.plus.com>

>
> 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 <glynn at gclements.plus.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20100305/49af09a1/attachment.html


More information about the grass-user mailing list