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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:52:02+00:00 2026-05-28T18:52:02+00:00

Is it possible to start up a daemon from java. Specifically, I am trying

  • 0

Is it possible to start up a daemon from java. Specifically, I am trying to use MongoDB in java however I want my application to start up the mongod daemon if it not already running. I seem to be able to start it ok, exitcode is 0. However it always exits immediately. Is it possible to force it to stay running, then quit it with proc.destroy()?

ProcessBuilder pb = new ProcessBuilder("./bin/mongod","--dbpath data/db");
Process proc = pb.start();

If i set a breakpoint after i start the process the hasExisted boolean is always true, the exit code is 0 and I cannot connect to.

Also this is on OS X 10.5, I know ProcessBuilder is finicky across OS

  • 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-28T18:52:03+00:00Added an answer on May 28, 2026 at 6:52 pm

    Your command and path are probably not handled properly.
    Here is what needs to be done in pseudo java (groovy) to run mongodb after a fresh install with brew

    ProcessBuilder pb = new ProcessBuilder(["/usr/local/bin/mongod","run", "--config", "/usr/local/Cellar/mongodb/2.0.1-x86_64/mongod.conf"]); 
    
    Process process = pb.start()
    
    InputStream is = process.getInputStream();
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line;
    while ((line = br.readLine()) != null) {
            System.out.println(line);
    }
        
    
    int exitValue = process.waitFor()
    print exitValue
    

    You can type the above directly in a groovy console.

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

Sidebar

Related Questions

Is it possible to get a thread dump of a Java Web Start application?
Is it still possible to start a 'native' application under windows via a java
Do you know is it possible to start iPad application from another application that
Is it possible to start an array at an index not zero...I.E. you have
Is it possible to start other application that are installed on the system with
Is it possible for a signed Java Applet or Web Start app to write
I know this is possible but I'm not really sure where to start. Has
Is it possible to start an Activity from a Service? If yes, how can
Is it possible to start a slideshow from a Powerpoint 2010 add-in?
I am aware of the command to start the sphinx daemon manually. I use

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.