<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://grasswiki.osgeo.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E2%9A%A0%EF%B8%8FApachemaven</id>
	<title>GRASS-Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://grasswiki.osgeo.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E2%9A%A0%EF%B8%8FApachemaven"/>
	<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/wiki/Special:Contributions/%E2%9A%A0%EF%B8%8FApachemaven"/>
	<updated>2026-05-26T07:46:14Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=GRASS_and_Java&amp;diff=10607</id>
		<title>GRASS and Java</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=GRASS_and_Java&amp;diff=10607"/>
		<updated>2010-03-24T05:34:48Z</updated>

		<summary type="html">&lt;p&gt;⚠️Apachemaven: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''ADD MORE PLEASE''&lt;br /&gt;
&lt;br /&gt;
Define:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
       public String run(String[] cmd)  {&lt;br /&gt;
       ...&lt;br /&gt;
                       Process p1=rt.exec(cmd, env);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and use:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
       gm.run({&amp;quot;r.info&amp;quot;, &amp;quot;map=roads&amp;quot;});&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples ====&lt;br /&gt;
&lt;br /&gt;
It seems that calling grass in java by using java.Lang.Runtime.exec() can be implemented easily in Linux platform(Tests in Ubuntu 9.10 passed yet).&lt;br /&gt;
&lt;br /&gt;
First install the grass use the apt-get:&lt;br /&gt;
sudo apt-get install grass  //it will install the latest stable version&lt;br /&gt;
After the installation completed you can:&lt;br /&gt;
#Test it in the terminal without java(make sure that you have the GisDataBase installed,,):&lt;br /&gt;
open a terminal and enter:&lt;br /&gt;
grass or grass64 or grass63 -text, the following the instruction in the screen.&lt;br /&gt;
&lt;br /&gt;
#Test using grass command directly in the terminal:&lt;br /&gt;
##set the environment // the grass is installed under /usr/lib/grass64.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export GISBASE=/usr/lib/grass64&lt;br /&gt;
export GISRC=/home/kk/gisrc&lt;br /&gt;
export ldLibraryPath=$GISBASE/lib&lt;br /&gt;
export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then try the grass command directly, for example:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
g.version&lt;br /&gt;
g.gisenv&lt;br /&gt;
........&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Easily call grass in java if the test 2 passed. &lt;br /&gt;
Just use the Runtime.getRuntime.exec(String cmd,String[] env):&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
String cmd=&amp;quot;g.version&amp;quot;;&lt;br /&gt;
String[] exe = { &amp;quot;bash&amp;quot;, &amp;quot;-c&amp;quot;, cmd };&lt;br /&gt;
String[] env={&amp;quot;GISBASE=..&amp;quot;,&amp;quot;GISRC=&amp;quot;&amp;quot;.......}; the environment variables which you used in the &lt;br /&gt;
Process p=Runtime.getRuntime.exec(exe,env);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
//FIXME for the format.&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Linking to other languages]]&lt;br /&gt;
[[Category:Java]]&lt;/div&gt;</summary>
		<author><name>⚠️Apachemaven</name></author>
	</entry>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=GRASS_and_Java&amp;diff=10481</id>
		<title>GRASS and Java</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=GRASS_and_Java&amp;diff=10481"/>
		<updated>2010-03-08T01:56:39Z</updated>

		<summary type="html">&lt;p&gt;⚠️Apachemaven: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;''ADD MORE PLEASE''&lt;br /&gt;
&lt;br /&gt;
Define:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
       public String run(String[] cmd)  {&lt;br /&gt;
       ...&lt;br /&gt;
                       Process p1=rt.exec(cmd, env);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and use:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
       gm.run({&amp;quot;r.info&amp;quot;, &amp;quot;map=roads&amp;quot;});&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Examples ====&lt;br /&gt;
&lt;br /&gt;
It seems that calling grass in java by using java.Lang.Runtime.exec() can be implemented easily in Linux platform(Tests in Ubuntu 9.10 passed yet).&lt;br /&gt;
&lt;br /&gt;
First install the grass use the apt-get:&lt;br /&gt;
sudo apt-get install grass  //it will install the latest stable version&lt;br /&gt;
After the installation completed you can:&lt;br /&gt;
1)Test it in the terminal without java(make sure that you have the GisDataBase installed,,):&lt;br /&gt;
open a terminal and enter:&lt;br /&gt;
grass or grass64 or grass63 -text, the following the instruction in the screen.&lt;br /&gt;
&lt;br /&gt;
2)Test using grass command directly in the terminal:&lt;br /&gt;
#set the environment // the grass is installed under /usr/lib/grass64.&lt;br /&gt;
export GISBASE=/usr/lib/grass64&lt;br /&gt;
export GISRC=/home/kk/gisrc&lt;br /&gt;
export ldLibraryPath=$GISBASE/lib&lt;br /&gt;
export PATH=$PATH:$GISBASE/bin:$GISBASE/scripts&lt;br /&gt;
&lt;br /&gt;
Then try the grass command directly, for example:&lt;br /&gt;
g.version&lt;br /&gt;
g.gisenv&lt;br /&gt;
........&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3)Easily call grass in java if the test 2 passed. &lt;br /&gt;
Just use the Runtime.getRuntime.exec(String cmd,String[] env):&lt;br /&gt;
String cmd=&amp;quot;g.version&amp;quot;;&lt;br /&gt;
String[] exe = { &amp;quot;bash&amp;quot;, &amp;quot;-c&amp;quot;, cmd };&lt;br /&gt;
String[] env={&amp;quot;GISBASE=..&amp;quot;,&amp;quot;GISRC=&amp;quot;&amp;quot;.......}; the environment variables which you used in the &lt;br /&gt;
Process p=Runtime.getRuntime.exec(exe,env);&lt;br /&gt;
&lt;br /&gt;
//FIXME for the format.&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Linking to other languages]]&lt;br /&gt;
[[Category:Java]]&lt;/div&gt;</summary>
		<author><name>⚠️Apachemaven</name></author>
	</entry>
</feed>