> We are trying to run a command line command, namely wget, in our java
> program. Is there a way to do something like 'wget http://www.cumtd.com'?
See the Runtime class (esp Runtime.exec(String command))
> We are trying to run a command line command, namely wget, in our java
> program. Is there a way to do something like 'wget http://www.cumtd.com'?
URLConnection con = new URL("http://www.cumtd.com").openConnection();
"If all you have is a hammer, everything looks like a nail"
http://c2.com/cgi/wiki?GoldenHammer
Don't be a victim.
99% of the time I've seen a system call or the use of JNI, it was for the
wrong reason.

Signature
Tony Morris
http://xdweb.net/~dibblego/
John Resler - 17 Mar 2005 06:08 GMT
I agree with the Runtime.exec method but it is not portable. Java's
design was really built around
the Unix model of processes, etc. and Windows command line programs are
hindered by the lack
of a true shell interpreter like Bash or the Korn Shell. Nonetheless, it
is fairly simple to start a process
up and monitor it's output. The difficulty I'm having is controlling
external processes with Java. Perhaps
this is asking to much of Runtime.exec. In any event, here's a link to a
good article on using Runtime.exec.
Cheers.
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps_p.html
-John
>
>
[quoted text clipped - 12 lines]
>
>