[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 286
  • Last Modified:

running and monitoring sub process ...

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
yossim111799
Asked:
yossim111799
  • 2
1 Solution
 
Igor BazarnyCommented:
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
 
sghosh092199Commented:
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
 
sghosh092199Commented:
The Process Monitor will be Taskmgr.exe. PerfMon.exe is the Performance Monitor
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now