Solved

running and monitoring sub process ...

Posted on 2001-07-02
3
278 Views
Last Modified: 2010-04-16
I need to activate a process from my java application,
the process is an exe file that fuction as a server
this server is activating another demon.

my problem is that I need to know when this demon was launched and then continue with my code.

How can I solve this problem ?
how can I get the information on a process running on the OS (in my case NT) that was not been activated directly by me.

0
Comment
Question by:yossim111799
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
Igor Bazarny earned 150 total points
ID: 6245548
Hi,

As far as I know, you can't. Aren't you going to communicate with your daemon? I would just try to connect, wait and retry until connection succeeds

Regards,
Igor Bazarny,
Brainbench MVP for Java 1
www.brainbench.com
0
 
LVL 3

Expert Comment

by:sghosh092199
ID: 6245797
Hi!

The problem has two parts:
1. To activate a process from the Java application:

Process serverProcess = Runtime.getRunTime().exec("c:\\Executables\\Server.exe");

The exec() methods create a native process 'serverProcess' and it is possible to communicate with the process through I/O streams. Since 'serverProcess' is responsible for activating a daemon, it can get the time of activation and pass on to its OutputStream, which the program can read the InputStream.

InputStream in = serverProcess.getInputStream();
OutputStream out = serverProcess.getOutputStream();

2. In order to know about processes on the OS, you can launch the Process Monitor PerfMon.exe as above and check on its output via OutputStream.  

Hope that helps!
0
 
LVL 3

Expert Comment

by:sghosh092199
ID: 6245822
The Process Monitor will be Taskmgr.exe. PerfMon.exe is the Performance Monitor
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now