I've written an application that serves as a floating desktop "button bar" (call it MyApp). The requirements for it were that: 1. All the java applications launched from it had to all run on the same JRE 2. MyApp had to be completely ignorant of the applications it would be launching. That is, when MyApp runs, it reads a prefs file to get information (location, class names, etc.) on the classes it will have to load. An application's main class is loaded like so:
The application is launched like this:
The application is launched by MyApp (and MyApp retains no reference to it at all). Technically, the launched application is running as a seperate process on the JRE (a thread launched by MyApp), but the effect is the same. So far, so good. PROBLEM: I had to implement a custom SecurityManager that prevented a quitting application (using System.exit()) from killing the JRE (and hence all the other Java apps). Side effect: the application stops running, but the memory it used isn't reclaimed. MyApp has no refence to the application that was launched, and can't explicitly kill it. Hence MyApp is a slow, and potentially very large, memory leak. Not good. Does anyone know of another way to do this? A method that would keep a reference to the launched processes so they could be explicitly terminated? Is there a way for my custom SecurityManager to get a handle on the process that initiated the System.exit()? Any help would be appreciated.
[This message has been edited by Matt Senecal (edited July 30, 2001).]
There's nothing more dangerous than a resourceful idiot. ---Dilbert
Matt, this start bar idea sounds very familiar to me; I think I read about it in a book or on some website. Maybe other people have done this and a little searching may turn up their results. You may also want to look into JumpStart/WebStart, as they may have played around with similar ideas, and encountered some of these issues. --Mark
subject: Need help running multiple apps on same JRE