INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

how to wait n seconds for Runtime.getRuntime.exec() to execute

how to wait n seconds for Runtime.getRuntime.exec() to execute

how to wait n seconds for Runtime.getRuntime.exec() to execute

(OP)
Hi,

Some system commands would halt the execution if one has not enough privileges to do so. How, can I allow my runtime to try for - let's say - 10 seconds. But if nothing is return and the command is blocked, then continue.

What's a solid approach to this?

Thanks for any hints.

RE: how to wait n seconds for Runtime.getRuntime.exec() to execute

You can use Thread.sleep to wait, but I guess you will have to check the command output, depending on what you're executing.

Cheers,
Dian

RE: how to wait n seconds for Runtime.getRuntime.exec() to execute

You should start the external program in a seperate thread, and then you may wait in the main thread for 10 s.

Maybe you can kill the separate thread, if it didn't finish from there; at least continue your work.  

don't visit my homepage: http://home.arcor.de/hirnstrom/minis/index.html

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close