problem with runtime and exec

Hello.
I want use 'wget' command from my Java application
for 'wget' i created command as String type.
Here is it

[code]String url_str=wget --post-data "year=2009&month=08&day=01&time=0&profile=1&start=0&stop=1000&step=50&par=&format=0&vars=01&vars=02" http://testsite.com/cgi/script.cgi -O /home/user/test_wget.txt
[/code]

then i use it in exec method

[code]

...
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();
}
[/code]

after running the file test_wget.txt hold
[code]Model Error
Wrong key: not alpha/numerical characters[/code]

however, if i use my url_str from Linux command line
test_wget.txt is hold usefull data.

So, how working correct with wget from Java application?


Thanks for any replys
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories