Click to See Complete Forum and Search --> : Single Process


Stefan Rauch
March 1st, 1999, 04:00 AM
Hi there !


I'm trying to write an application using jdk 1.1.6 with jbuilder2 and I've got some sort of problem.

As my application is doing some file transfer through http and on the client it would be fine (it seems also necessary to me...), that there is only one instance of this application running at a time.

To make sure, I don't mean a kind of singleton class, that can be instantiated only once, but a kind of application which can NOT be started a second time at a while. The problem is that the user of my application may try to start it a second (or even a third) time during one of the applications is still running. This would cause a lot of trouble on the local file system. How can I provide a mechanism, that stops the user from doing this nonsense ???

As I'm not sure whether this application will be started from the java-machine or will be an executable (name.exe), I would be glad to get any hints and support on this problem.

My thoughts to solve this problem are:

1. If the application is an executable, try to get the process list of the client and search for a process named application_name.exe ! Problem: I'm not sure, how to get Information about the clients process list. This is not provided by the System.getProperty() method.

2. If it is an java class I can't imagine how to get Information which application is started within the java-machine. (As there is always a new java-machine running the application).

Maybe there is a possibility to write information in a system-variable, but I don't know how to do this.

3. One way to solve this problem seems to make the whole application system modal - but this doesn't seem to be the way I would like to handle the problem.

(but if it is the only way - I'd appreciate a little hint how to do this !)


If anyone out there has got some experience in this kind of problem I'd be glad to here from you !


Thanks a lot, I'm looking forward to your suggestions !


der Stefan.