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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:25:36+00:00 2026-05-11T12:25:36+00:00

I need to start 1-3 external programs in my Java application that have paths

  • 0

I need to start 1-3 external programs in my Java application that have paths defined by the user. I have few requirements:

  1. I don’t want the program to execute if it is already running

  2. I don’t want any of the programs to steal focus from my Java application

  3. I don’t care if any of them fail to start or not. They just need to fail silently.

Here is what I have come up with so far:

ProcessBuilder pb = new ProcessBuilder(userDefinedPath1); try {     pb.start(); } catch (Exception e) {     // Something went wrong, just ignore } 

And then I repeat that 3 more times with the other two paths. This starts like I would expect and meets my third requirement just fine, but fails on the first two.

What is the best way to do this?

Edit:

  1. I don’t have any control of these other apps. They are third party. Also, they could have been start or stopped by the user manually at any time.

  2. I know the exact names of the executables (e.g. ‘blah.exe’) and they will always be the same, but the paths to the executables won’t necessarily be.

  3. Batch file wrappers are not feasible here.

  4. The other apps are not java apps, just plain old Windows executables.

  • 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. 2026-05-11T12:25:36+00:00Added an answer on May 11, 2026 at 12:25 pm

    I’m guessing you don’t have control over the other two apps… If you did, this wouldn’t be too bad–you could just have them listen to a socket and see if the socket is available when you come up.

    The next solution may actually be language independent. You could manage the whole system through batch file wrappers. Write a batch file that creates a file when it starts up and deletes it when it stops. Unix systems use this technique a lot–they call the file a lock file more often than not.

    If only your app will ever start these other apps, then you could simply track if you’ve started it or not, so I’m guessing this isn’t possible or you wouldn’t be asking, so I’m assuming that the user may have launched these programs through some other mechanism.

    If you have NO control over the launching of the other apps and can’t even write a batch file to launch them, then you just can’t do what you want to do (Note, the apps would have to always use the batch file, even if the user started them by hand).

    I just a very-last ditch effort might be to get a process status and parse it, but you’d have to know exactly what the other apps were called in the PS, this isn’t really trivial. Also, all java apps tend to have the same exact signature in most process status printouts which could make this useless.

    The problem is that if one of these programs were started outside your app, you have virtually NO WAY to identify that fact unless you happen to know it’s exact process status signature, and even then it’s flaky.

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

Sidebar

Ask A Question

Stats

  • Questions 179k
  • Answers 179k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In the general situation : the session id is sent… May 12, 2026 at 3:53 pm
  • Editorial Team
    Editorial Team added an answer One way is by placing the models childnodes inside their… May 12, 2026 at 3:53 pm
  • Editorial Team
    Editorial Team added an answer IList<int> list = new List<int>( new int[] { 1, 2,… May 12, 2026 at 3:53 pm

Related Questions

I need a script to run on Vista Ultimate to share an external drive
Im in the process of writing a python script to act as a glue
Until recently we were using Inno Setup for our installations, something I would like
I want to use the NSStatusBar object from my Java application using JNI. I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.