Article View: borland.public.jbuilder.java.api
Article #2904Re: Don't run program if another instance already running.
From: fear1
Date: Sat, 22 Aug 1998 00:00
Date: Sat, 22 Aug 1998 00:00
18 lines
1578 bytes
1578 bytes
Sounds more like you need a singleton object rather than a program. Communication accross JAVA virtual machines requires special IPC methods like sockets, RMI, CORBA etc. For your particular situation you could create a "ping" socket on your program. Something that writes the word "alive" to the socket when a connection is made. You could then either check this by hand (with a telnet client) or write another very simple application to do it for you. The java.net library is very powerful and easy to use. RMI and CORBA require a great deal more learning and over head and would be like killing a fly with a shotgun for this particular problem. Hope this helps. Will Williamson wrote: > > Does anyone know how a program can check to see if another instance of > itself is running before launching a new instance. I need to make sure that > only 1 instance of a program is loaded at any time on a particular > omputer. - Will Williamson.
Technical Details
Message-ID:
<35DEF6DF.8F1551AD@home.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<oWEC1.431$nY4.221839385@newsreader.digex.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,cfc79d171f9430d6 X-Google-Attributes: gid1089d0,public From: fear1 <fear1@home.com> Subject: Re: Don't run program if another instance already running. Date: 1998/08/22 Message-ID: <35DEF6DF.8F1551AD@home.com> X-Deja-AN: 383679444 Content-Transfer-Encoding: 7bit References: <oWEC1.431$nY4.221839385@newsreader.digex.net> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: @Home Network MIME-Version: 1.0 NNTP-Posting-Date: Sat, 22 Aug 1998 09:52:25 PDT Newsgroups: borland.public.jbuilder.java.api