wood burning stoves*
The moose likes Java in General and the fly likes process wait or pause feature needed for java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "process wait or pause feature needed for java code" Watch "process wait or pause feature needed for java code" New topic
Author

process wait or pause feature needed for java code

jay start
Greenhorn

Joined: Apr 08, 2010
Posts: 3
Here is some code that work without a problem. My issue is, I need to insert some java code to:

1) pause and/or wait for the tftp process to finish, then;
2) execute the downloaded router image.

I can only manage to get the router_image downloaded. I'm stumped on how to carry it farther and do 1 and 2, above.

Any help much appreciated.

Nick Puketza
Greenhorn

Joined: Apr 01, 2010
Posts: 16
Hi Jay,

As for the waiting, I am not sure, but you might check out the Process class description
in the API specification. The waitFor() method looks promising.

http://java.sun.com/javase/6/docs/api/java/lang/Process.html
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3019
    
  35

"jay start", please check your private messages regarding an important administrative matter.


Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

Nick Puketza wrote:Hi Jay,

As for the waiting, I am not sure, but you might check out the Process class description
in the API specification. The waitFor() method looks promising.

http://java.sun.com/javase/6/docs/api/java/lang/Process.html

Which requires one to have read the Javaworld article "When Runtime.exec() won't".
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38033
    
  22
Welcome to the Ranch

I shall move this thread because it is more difficult than we expect for "beginning Java".
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Why not use a Java FTP library and bypass the vagaries of exec()?
jay start
Greenhorn

Joined: Apr 08, 2010
Posts: 3
Campbell Ritchie wrote:Welcome to the Ranch

I shall move this thread because it is more difficult than we expect for "beginning Java".


Can you tell me to where you moved it so I can go there and follow up? Thank you.
jay start
Greenhorn

Joined: Apr 08, 2010
Posts: 3
David Newton wrote:Why not use a Java FTP library and bypass the vagaries of exec()?


That looks very promising. Any idea on the general structure of how I could do that with this code? Thank you.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Just call a non-asynchronous FTP method; when it returns it's done.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38033
    
  22
jay start wrote: . . . tell me to where you moved it so I can go there and follow up? Thank you.
Here
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: process wait or pause feature needed for java code
 
Similar Threads
runtime.exec() to call unix commands
Screen capture of web page?
problem calling isql or osql from java
Runtime.exec( ) is hanging....
How to close dos 'pause' command in Java