End of process detection

Hello

I have a 'mother' - process in which the user can start multiple sub-processes
running simultaneously, which means after launching a sub-process, the user can
immediately more launch away from the subprocess.
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;

public class ProcessStatus extends JFrame implements ActionListener {
  JButton b1, b2, bExit;

  public ProcessStatus() {
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setLayout(new FlowLayout());
    b1= new JButton("Process 1");
    b1.addActionListener(this);
    add(b1);
    b2= new JButton("Process 2");
    b2.addActionListener(this);
    add(b2);
    bExit= new JButton("Exit");
    bExit.addActionListener(this);
    add(bExit);
    pack();
    setVisible(true);
  }

  public static void main(String args[]) {
    EventQueue.invokeLater(new Runnable() {
      public void run() {
     new ProcessStatus();
      }
    });
  }

  public void actionPerformed(ActionEvent evt) {
    String cmd= "";
    Object obj= evt.getSource();
    if (obj==b1)
      cmd= "cmd /C start explorer";
    else if (obj==b2)
      cmd= "cmd /C start notepad";
    else
      System.exit(0);
    try {
      Process proc= Runtime.getRuntime().exec(cmd);
    }
    catch (IOException e) {
      System.err.println(e);
    }
  }

}
Now, I would like to check the status of each process termination but am stuck.
I can't use waitFor(), as this could block the application and
prevent the user to launch more far subprocess. So in fact I'm
you are looking for a kind of "ProcessTerminationListener".
Despite the NBS my real application does not call win - explore or
Notepad, but own jar files. If I could implement some interprocess
communication. However, it would be nice, if I could do without.

Do you have any suggestions?

Get rid of "cmd /c start" and Add .exe. The process you would expect is the shell, which is immediately smoothly.

Tags: Java

Similar Questions

  • I had some problems with my pc, since then when I close Firefox it would not reopen unless I go to Task Manager and end the process for FF.

    I had some problems with my pc, since then when I close Firefox it would not reopen unless I go to Task Manager and end the process for FF. I uninstalled FF and re-installed and no change.
    Walt

    I have a same problem.

  • I get the following message appears when you try to open Photoshop... "Could not initialize Photoshop because an of.file - unexpected end has been detected. Help! You can use my Photoshop!

    I get the following message appears when you try to open Photoshop... "Could not initialize Photoshop because an of.file - unexpected end has been detected. Help! You can use my Photoshop!

    Hi romyb,

    End of file unexpected refer and let us know if this helps.

    Kind regards

    Assani

  • Fiscal year ending the process in GL

    Hi gurus,

    Can someone help me in explaining Year - End - process Oracle General Ledger?

    Thanks and greetings
    Bharath

    You can find all the info on MOS score:

    General accounting year-end closure process [66532.1 ID] Oracle
    What is the behavior of the General Ledger year end closing process general [149999.1 ID]
    Close period advising: E-Business Suite (EBS) [ID 335,1]

    Kind regards

  • End a process in the middle if a user chooses to?

    How do I end a process in the middle if a user choose?

    1. I.E.

    I submit a request for leave. My Manager sent to me to review. I decide that I don't want the day off.

    Can I add a user action called with drawn, but what is the destination? There is no end of activity appeal process?

    Dan said:

    You should be able to put everything in something abstract, link to it and make it conditional

  • How to end a process of each queue?

    Hello

    How to end a process of each queue to the user in a workspace after the date limit? Suggest ways or orchestrations that can put an end to the process.

    Thank you

    Jaison.

    What is a task or just a notification that remains in the queue for the user?

    Jasmine

  • Vista DEP ends the process of upgrade of Sony Picture Motion Browser (PMB)

    I have a problem with Windows Vista Home Premium.  I am trying to upgrade my version of Sony Picture Motion Browser (PMB) to version 5.2 running the updated DownloadManager_1005c.exe utility, which was downloaded from the Sony website.  When I run this program, Windows Vista puts an end to the process by closing IE.  I first added to the DEP exception list download manager, it did not work.  Then I ran "bcdedit.exe/set {current} nx AlwaysOff" from the prompt order and received confirmation "Operation completed successfully".  I rebooted the computer and the Sony service program is represented.  Yet once Vista has completed the process.

    How can I solve this problem and update my software of Sony?

    I try to download the upgrade on your desktop directly from the Sony site (or wherever you want come in) and work around by using the Download Manager entirely.  Once saved to your desktop, right-click on the download and click on run as administrator and see if it successfullly upgrades your Sony software.  I suspect the Download Manager is a tool that is useful but not required to download or upgrade.

    Because you have executed this command, DEP must disable so it should not be the cause of this problem (if it is in the first place).  Remember when all this is done to reactivate.

    If the above does not work, I recommend you contact Sony Technical Support at:http://esupport.sony.com/US/perl/select-system.pl?DIRECTOR=CONTACT and see if they can provide assistance with this problem on their software - download manager, upgrade, or both.

    I hope this helps.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • End of Audio detection

    Hello all;

    From 2014 and more.

    I need to check and see if the Audio has stopped playing.

    Remember, there is nothing on the timeline, it is a file of reading mps.

    I want to know when it's over, so I can play the next song online.

    I tried to use it.

    If (sym.$("_05letitbe") [0] .stop) {}

    code here

    }

    However, it does not detect the song ending, unfortunately.

    Any idea?

    Wayne

    Hello

    Audio or video, there is an event. See: Animate - video edge hide when finished

  • I clicked on update of my modules, and it does not end the process. Don

    I am not able to use flash player without updating the plugin. So I clicked on "modules update" and it is still being processed, for about 2 hours. Don't know if this is normal or if something went wrong. Thank you, Don

    Why not just download the installer and install it manually? It's a lot less worth in this way. You can get it here:

  • to end a process in exec system via ctrl + c

    I run a process in the command that is invoked by exec system window. The only possible way to complete and return to the main command window is via Ctrl + c. How to implement it?

    No idea...

    I solved it... was easy enough.

    Create a digital constant corresponding to the CTRL, convert U8 and kind of climbing and use the output of the channel and paste in the command prompt.

    Works well...

  • Task Manager give me an access denied error when I try to set the affinity or end a process.

    Hello
    I tried to change some of the settings of my PC compared to a game do not set up for dual-core systems.
    I tried to change the affinity settings in the Task Manager and I get an error of access denied even if I have one in an administrator account. I am the only user of this system and it is very frustrating to be unable to edit my own settings.  I am running Vista 32 home edition on a system of dual-core AMD.
    I also tried to change the affinity with the line of the command prompt and change the shortcut to do so, but this did not succeed. The command prompt will not find the program and when I use the shortcut to set the affinity with the command prompt, it didn't he open the window command prompt and nothing else.  If someone could give me a hand here, I'd appreciate it.  I am familiar with specific vagaries of Vista and I'm getting a little angry.

    Do you have UAC turned on?

    If you do, then, when you're in the Manager of tasks under the processes tab, select "Show processes from all users" accept the UAC prompt.
    This will be the the Task Manager with your administrator privileges. You should now be able to set the affinity.

  • I ended the process windows exploror and changed my theme

    I tried to restart the computer 2 times and the process runs again, but I have a kind of classic theme now and can not change, I went to advanced tools > adjust the appearance and performance of windows, visual affects and tried to check the lower box that says use Visual styles on windows and buttons and clicked on apply but it keeps unchecking. So I'm frustrated verry

    Try to change your theme:

    1. open theme settings by clicking the Start button, clicking Control Panel, appearance and personalization, personalization and then click theme.

    2. under theme, select "Windows Vista", and then click OK. "

    Or change your color scheme:

    1. open appearance settings by clicking the Start button, clicking Control Panel, on appearance and customization, personalization, and then clicking window color and appearance, at the bottom of the page, click Open classic appearance properties.

    2. in the color model list, click on ' Windows Aero", and then click OK."

    Solve problems with Windows Aero
    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-problems-with-Windows-Aero

  • To end a process without the Task Manager

    Can I terminate a process with a command line instead of using the Task Manager in Windows XP, W2K, Windows 7?

    Never mind people, I found it.  This is the command "taskkill".  duh!

  • Since Firefox automatically updated my plugins, it is not closed and it won't let me log back. I have to go to Task Manager to end the process.

    Grrrrrrrrrrrrrrrrr. You deleted my content!

    Try using ' Firefox/file > exit ' (Mac: ' Firefox > leave ";) Linux: "file > exit ') to close Firefox if you're doing that by clicking on the X close in the title bar.

    See:

    These issues can be caused by a plugin or extension that does not close properly.

  • LR does not start at all in winning 10.  Once I upgraded, it stopped working.   Just, he sits and does nothing and I have to launch the Task Manager to end the process

    Is there a way to upgrade...  I use a direct copy and not cc.

    I have seen that it is a universal problem with lr on Win 10.  What can I do?

    Hey benr,

    You need to install/repair Microsoft Visual C++ 2012 updated 4: Download Visual C++ Redistributable for Visual Studio 2012 updated 4 of the official Microsoft Download Center

    In addition, upgrade to version 6.5: keeping up-to-date for Lightroom

    Kind regards

    Claes

Maybe you are looking for