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

  • SEARCH
  • Home
  • 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 8127805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:39:38+00:00 2026-06-06T07:39:38+00:00

I am using the Runtime class to execute a piece of installation of a

  • 0

I am using the Runtime class to execute a piece of installation of a software. However, its not working, meaning that, after I fire the job (which is created using the Runtime class), after sometime (which is very soon) the installation job just exits. I think the problem is that the main thread must be finishing up and thus killing the Process that is created using the Runtime class. Am I correct ? And what is the solution here ?

this is how I fire my job inside teh main class :

try
        {
            Runtime.getRuntime().exec(cmd);
        }                               
        catch(IOException e)    
        {   
            //add logging functionality
            e.printStackTrace();
        }

Soon after this command, the main function finishes.

There is no problem with the Runtime command. It works .. I can even see it starting(the installation taht I am firing thru the code) and then it suddenly exits.

  • 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-06-06T07:39:39+00:00Added an answer on June 6, 2026 at 7:39 am

    You might want to check out the java.lang.Process class. You probably want something like this:

            Process process = Runtime.getRuntime().exec(cmd);
            process.waitFor();
    

    The subprocess may be receiving a SIGHUP and exiting.

    EDIT:

    In context, something like this, I would think:

        try
        {
            Process process = Runtime.getRuntime().exec(cmd);
            process.waitFor();
        }                               
        catch(IOException e)    
        {   
            //add logging functionality
            e.printStackTrace();
        }
        catch(InterruptedException e)    
        {   
            e.printStackTrace();
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to execute a copy of the Perl interpreter using Java's Runtime.exec(). However,
I'm trying to write something that calls a function at runtime without using reflection.
I'm trying to execute a simple batch file from java using Runtime.getRuntime().exec(command); but facing
I wrote a Java program that can execute another Java program during runtime. The
I am using java Runtime.exec() method to execute bat file,in bat file i have
I plan to execute a jar command using a jar that is included in
I'm using Runtime to make a call to the system. When I call it
I am trying to spawn a process using Runtime.exec. I want to use my
when you dynamically load a library at runtime using LoadLibrary in windows (C++), does
I'm running Django on AppEngine (python 2.7 runtime) using their Cloud SQL. I've setup

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.