Re: launch one instance for imageJ
Posted by
ctrueden on
Sep 28, 2005; 10:11pm
URL: http://imagej.273.s1.nabble.com/launch-one-instance-for-imageJ-tp3704732p3704736.html
Hi Dong Fang,
It would certainly be possible to modify ImageJ to prevent it from
spawning multiple instances. One way to do this is to use sockets.
For instructions on this method, see:
http://www.rgagnon.com/javadetails/java-0288.htmlBasically, the running instance listens on a port for incoming command
line arguments from any additional instances that get launched.
Additional instances detect that the port is already open, send their
arguments, then terminate.
If you want a real-world example, I use this technique in my VisBio
application (
http://www.loci.wisc.edu/visbio/). See
loci/visbio/util/InstanceServer.java, loci/visbio/VisBio.java, and
loci/visbio/VisBioFrame.java for the relevant code.
Cheers,
-Curtis
Lei, Dong Fang wrote:
>Hi all
>
>
>
>I do some change on ImageJ1.3.2 for supporting a new image data type
>(.qif) and recompile it to .exe.
>
>
>
>In my system, I set that it get .qif file to open by double clicking.
>But that was a problem was that I would open launch another instance of
>ImageJ each time I clicked on a file. It is better that if have one
>ImageJ instance, it does not open another ImageJ instance when double
>clicking another .qif file.
>
>
>
>Maybe the problem is in main function which it always creates a new
>imageJ object. That is right?
>
>
>
>How do you think about that?
>
>
>
>Please give me some comments.
>
>
>
>Thank you very much.
>
>
>
>dongfang
>
>