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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:13:53+00:00 2026-05-26T00:13:53+00:00

In C, I can run a long blocking process in the background (AND HAVE

  • 0

In “C”, I can run a long blocking process in the background (AND HAVE IT CONTINUE TO RUN) after the starting process has exited.

void main(void)
{
      system("some_long_blocking_process &");
      exit();
}

// "some_long_blocking_process" is still running here (DESIRED BEHAVIOR)

Java’s getRuntime().exec() DOESN’T have this behavior. Instead, “some_long_blocking_process” ends immediately when the Java process ends.

Anyone know how I can recapture this behavior in Java?

  1. I am using Java 1.4 (No process builder)
  2. I specifically am looking to start the long blocking process and to exit immediately (no “waitFor(), etc.)
  3. Things I have already tried (the process runs correctly, but I still get the same undesired behavior)
    • adding “nohup” and run in foreground (“nohup some_long_process”)
    • adding “nohup” and running in background (“nohup some_long_process &”)
    • run in foreground (“some_long_process”)
    • run in background (“some_long_process &”)

THANKS!

Thanks to all the suggestions… I’ve decided to use jtahlborn’s answer (it worked for me)

  • 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-26T00:13:54+00:00Added an answer on May 26, 2026 at 12:13 am

    the only way we were able to achieve this with java was to add another layer of script. you need a simple wrapper script which invokes the app you actually want to run, e.g.:

    runner.sh:

    #!/bin/sh
    
    nohup "$@" > /dev/null 2>&1 &
    

    then invoke “/bin/sh runner.sh the real command” from your java program.

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

Sidebar

Related Questions

I have an unmanaged DLL with a function that can run for a long
I have a long-running SP (it can run for up to several minutes) that
I am making a media player ,who can run in background. i have to
OK - I know I can run my java process like this : java
I have a GUI application that needs to run long calculations (think a minute
I have a Ruby 1.9 script that I want to run as a long-running
I'm implementing a system that runs game servers. I have a process (the game
I have a rails 3 app which uses resque to run long running jobs
I can run the server on my local machine and connect to it on
I can run commands like vacuumdb, pg_dump, and psql just fine in a 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.