Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6225751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:53:58+00:00 2026-05-24T08:53:58+00:00

Runtime.getRuntime.exex(abc.exe -parameters); using .waitFor() does not help to determine the completion of process.

  • 0
Runtime.getRuntime.exex("abc.exe -parameters");

using .waitFor() does not help to determine the completion of process.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T08:54:01+00:00Added an answer on May 24, 2026 at 8:54 am

    Process.waitFor() (javadoc) should work. If it doesn’t work then either:

    • there’s a bug in the JVM or the OS (highly unlikely for something like this), or

    • there is something about the process and/or your Java code that means that the process won’t exit.


    In current releases of Java you can also use Process.isAlive (javadoc) to test the process status without blocking until it finishes. For Java 7 and older there is a hacky solution that entails polling the process return code and catching an exception, but this is inefficient. You should upgrade to Java 8 or later as soon as possible!


    Once the task is finished its goes for an indefinite wait. (I don’t know why).

    If this happening, then neither waitFor() or isAlive() will help.

    The most likely reasons that a process launched from Java won’t / can’t exit are:

    • the process is blocked waiting for your Java application to give it some input (via its stdin),

    • the process is blocked waiting for your Java application to read its output (i.e. its stdout or stderr),

    • it is blocked waiting on some external event; e.g. if it is trying to talk remote server that is not responding,

    • something has sent it a STOP signal of some kind, or

    • it is just taking a looong time to run.

    The first two of these reasons / causes can be addressed by (respectively) closing the Java output stream connected to its standard input, and reading (and possibly discarding) the Java input streams connected to its standard output and standard error. The other causes are intractable, and your only options are to “wait it out” or attempt to kill off the process.


    Bottom line – you need to find out why your process isn’t completing. The blocked Process.waitFor() call is a symptom, not the disease.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

String command = javac -cp .:../sqljdbc.jar SetHash.java; Process child = Runtime.getRuntime().exec(command); try{ c= child.waitFor();
I am using Runtime.getRuntime.exec() Method to invoke an exe. The problem what I face
Process process = Runtime.getRuntime().exec(tasklist); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); process.waitFor();
i'm trying to remove junk files by using Process p = Runtime.getRuntime().exec(); it works
I am using Runtime.getRuntime().exec(test.class) to create a process and launch a test.class file. test.class:
I am creating a process using the below 2 lines Runtime rt = Runtime.getRuntime();
Is it possible to use Runtime.getRuntime().exec(cmd.exe); in gwt? When I compile it, I get
I have the next code: Process p = Runtime.getRuntime().exec(args); and I want my program
when try to execute the servlet containing following code Runtime rt = Runtime.getRuntime(); Process
Can somebody find what is wrong with this code: Runtime rt = Runtime.getRuntime(); Process

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.