Manipulating the Windows Environment from Java

  • Thread starter Gilbert Ostlethwaite
  • Start date
G

Gilbert Ostlethwaite

Hi

I have a third party java application that talks to a back end ERP
system through a C program (also third party & no source) that runs in
a Windows command window (it won't run as a Windows service). This
gateway is prone to falling over and the third party java app provides
a number of methods to interrogate the status of the C-program. At the
moment I have my own "heartbeat" program that calls these methods every
minute or so and fires off e-mails if it finds a problem.

Recently, the C-program has taken to falling over in the small wee
hours & I'm fed up with being woken up at dark o'clock several times a
week.

Is there a Java library available that will manipulate the windows
environment in such a way as to allow me to
a) Find the command window that the C-program is running in.
b) Close the program and command window (in effect issue Ctrl-C to the
window)
c) Open a new command window
d) Send the neccassary command string to the window that will restart
the program.

Regards
Roger
 
O

Oliver Wong

Gilbert Ostlethwaite said:
Hi

I have a third party java application that talks to a back end ERP
system through a C program (also third party & no source) that runs in
a Windows command window (it won't run as a Windows service). This
gateway is prone to falling over and the third party java app provides
a number of methods to interrogate the status of the C-program. At the
moment I have my own "heartbeat" program that calls these methods every
minute or so and fires off e-mails if it finds a problem.

Recently, the C-program has taken to falling over in the small wee
hours & I'm fed up with being woken up at dark o'clock several times a
week.

Is there a Java library available that will manipulate the windows
environment in such a way as to allow me to
a) Find the command window that the C-program is running in.
b) Close the program and command window (in effect issue Ctrl-C to the
window)
c) Open a new command window
d) Send the neccassary command string to the window that will restart
the program.

I don't think so. What you could do instead is have the Java program
itself run the C-program, and see if it can monitor that program in any way,
and if it detects that the program has failed, to re-run it. If the main
reason the command window was necessary was to see any output the C-program
might produce, you could write a simple GUI which just reads output from the
C program, and displays it in a text box.

- Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top