[GRASS-user] grass shell

Glynn Clements glynn at gclements.plus.com
Fri Mar 5 01:06:14 EST 2010


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"});

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list