<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'problem with runtime and exec' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'problem with runtime and exec' posted on the 'Java' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Thu, 20 Jun 2013 00:56:30 -0700</pubDate>
    <lastBuildDate>Thu, 20 Jun 2013 00:56:30 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>problem with runtime and exec</title>
      <link>http://www.programmersheaven.com/mb/java/427711/427711/problem-with-runtime-and-exec/</link>
      <description>Hello.&lt;br /&gt;
I want use 'wget' command from my Java application&lt;br /&gt;
for 'wget' i created command as String type.&lt;br /&gt;
Here is it&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;String url_str=wget --post-data "year=2009&amp;amp;month=08&amp;amp;day=01&amp;amp;time=0&amp;amp;profile=1&amp;amp;start=
0&amp;amp;stop=1000&amp;amp;step=50&amp;amp;par=&amp;amp;format=0&amp;amp;vars=01&amp;amp;vars=02" &lt;a href="http://testsite.com/cgi/script.cgi"&gt;http://testsite.com/cgi/script.cgi&lt;/a&gt; -O /home/user/test_wget.txt
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
then i use it in exec method&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;

...
try{
Runtime rt = Runtime.getRuntime();
Process p = rt.exec(url_str);
p.waitFor();
BufferedReader r = new BufferedReader(
     new InputStreamReader(p.getErrorStream()));
String s;
while ((s = r.readLine())!=null) {
   System.out.println( s );
}
r.close();
} 
catch (IOException e){
	// TODO Auto-generated catch block
	e.printStackTrace();
}
	
catch ( InterruptedException e ) { 
	e.printStackTrace(); 
}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
after running the file test_wget.txt hold&lt;br /&gt;
&lt;pre class="sourcecode"&gt;Model Error
Wrong key: not alpha/numerical characters&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
however, if i use my url_str from Linux command line&lt;br /&gt;
test_wget.txt is hold usefull data.&lt;br /&gt;
&lt;br /&gt;
So, how working correct with wget from Java application? &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thanks for any replys&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/java/427711/427711/problem-with-runtime-and-exec/</guid>
      <pubDate>Sat, 03 Mar 2012 10:36:58 -0700</pubDate>
      <category>Java</category>
    </item>
  </channel>
</rss>