Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

running and monitoring sub process ...

Posted on 2001-07-02
3
280 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Weekend adv creator 3 51
tomcat not starting 6 64
Opening PDF on button click and fill new document 2 47
Error in @AspectJ Based AOP with Spring 2 18
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

790 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