This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes application instantiation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "application instantiation" Watch "application instantiation" New topic
Author

application instantiation

Ben Wu
Greenhorn

Joined: Jan 02, 2002
Posts: 3
I have a legacy win32 app that currently outputs data once a system event occurs. The win32 app has a feature that allows it to call an application and pass it that data using command line arguments. (ex. "java GuiApp -arg1")
I written a small GUI app that's supposed to list all those events as they occur, the problem I have is that on every event, a new application is started instead of the data being passed to the running application.
Is there any way that I can set it so that once an app is started, that any future calls to that app will default to the running one?
Thanks.
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Originally posted by Ben Wu:
I have a legacy win32 app that currently outputs data once a system event occurs. The win32 app has a feature that allows it to call an application and pass it that data using command line arguments. (ex. "java GuiApp -arg1")
I written a small GUI app that's supposed to list all those events as they occur, the problem I have is that on every event, a new application is started instead of the data being passed to the running application.
Is there any way that I can set it so that once an app is started, that any future calls to that app will default to the running one?

No, I don't think you can do this as simply as you hope.
However, it's not that hard to achieve the effect that you want.
You need a small program that is started by your legacy application and makes a remote call to your permanently-running GUI application, passing the system event data, then exits.
The GUI application receives these remote calls and acts upon them.
If you write both programs in Java, you could use RMI for your remote calls. This has the advantage of being really easy.
However, starting a Java program is a fairly heavyweight operation. You might prefer that your short-lived program be something really small, in a language like C++. To achieve that, you could do the remote calls via CORBA (language-independent). Or, as the data you're passing is probably really simple, you could just use TCP/IP sockets.


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: application instantiation
 
Similar Threads
addShutdownHook (on Windows)
how to keep a java servlet running in the background?
JNI and C++
Java Application as NT Service
detect mouse event