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 9086755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:33:56+00:00 2026-06-16T21:33:56+00:00

I want to run a shell script from within a Java program asynchronously– i.e.

  • 0

I want to run a shell script from within a Java program asynchronously– i.e. after the java program starts execution of that shell script, it carries on with other operations– and does some further work only when the shell script returns a response to it.. i.e. it does not explicitly stop and wait for the shell script’s response.

Is this possible/feasible? How do I implement such functionality?

Basically i will be monitoring multiple servers using a single server that will manage all those servers– for this it will run shell scripts on each of those servers…since there are many servers, and in java its recommended that number of threads not exceed number of cpu cores… hence I need a solution to this problem, that is not dependent on threading (because of threading limitations)…so that I can simultaneously (or near-simultaneously) fire off many such shell scripts without waiting for one of those scripts responses’ (as waiting would affect processing for other shell script commands)… another issue.. the shell commands need to be invoked either on local machine or on remote machines and response is needed from both types of shell script execution(viz local execution and remote execution)…

  • 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-16T21:33:57+00:00Added an answer on June 16, 2026 at 9:33 pm

    did you try anything?

    you can try something like:

    ProcessBuilder builder = new ProcessBuilder("your command to launch script");
    Process process = builder.start();
    

    And it does NOT wait by default for the process to complete, so you can execute your code next.

    And if you want to do some processing after the process is finished you can try:

    int exitVal = process.waitFor();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to run a program from within my Ruby script, but I want
I want to run a shell script from my program below but it doesn't
I have a shell script that I want to call from a python program,
I want to run a shell script on startup by google ,I found that
I want to run script file on android Shell using Native C program. I
I want run a script as follows: runner: ssh 'java program &' ssh 'java
I need to run a shell script at runtime from a WAR that I
I'm looking for a method to check from within my shell script that script
Initialize rbenv and run ruby script from shell script I want svnserve to run
I want to run a shell script restore as postgres user from php script

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.