How can keep only one VM running in One Operating System

S

Sanjay Meher

I have a java based application .

So when ever I am invoking this application it is started with a new JVM

But my requirement is to control the previous instance

If any existing application is running.


Actually I want to open only one instance of application So I want to

control over this if Any new instance is created .

Like the same way when I invoke a MS-Word document if currently any

Ms-Work is running than it does not spawn off another application .

it just make the instance there only

Thanks with regards

Sanjay Meher
 
T

Troy Kinsella

I have written a program that does just that in Java, althout the idea
is far from my own.

The program tries to connect to an instance of itself in an existing
process through tcp sockets upon loading the program. If the connection
is successful, a previous process existed and control is handed over to
that process and the new process is terminated. If the connection fails,
the program is executed for the first time and it continues as normal.
If no connection is made, a tcp server is initialized in order to
receive connections from possible future executions of the program.

This seems to work fine for me.

A good example of this implementation is in JEdit. The relevant code
exists in the EditServer class and the main() method in the JEdit class.

www.jedit.org

Hope that helps.
 
M

Manolis Christodoulou

Sanjay said:
I have a java based application .

So when ever I am invoking this application it is started with a new JVM

But my requirement is to control the previous instance

If any existing application is running.


Actually I want to open only one instance of application So I want to

control over this if Any new instance is created .

Like the same way when I invoke a MS-Word document if currently any

Ms-Work is running than it does not spawn off another application .

it just make the instance there only

Thanks with regards

Sanjay Meher

Take a look at the technology behinf jEdit http://www.jedit.org, an open
source text editor written in java. It uses the client server approach.
 
S

Sanjay Meher

Thank you very much

The open source code is more helpful also

Do any body have address for this type of Code

I need one in J2ee

Thanks with regrds

Sanjay Meher
 

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

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top