When jEdit is launched, it first attempts to locate another running instance before starting up for real. If another copy happens to be running, it transfers control to it, passing any necessary file names. This technique saves time and memory when jEdit is started multiple times.
Communication between instances of jEdit is implemented using TCP/IP sockets. When a server is started, it picks a random port number and authorization key (to prevent malicious remote users from opening files) and writes it to a port file (usually in a well-known location). Client instances of jEdit then read the port file and connect to the specified port, passing it the authorization key and the file names to open, if any.
The -noserver command line switch disables the server features entirely; no connection will be attempted, and no sever will be started. The -server command line switch specifies where port information is stored. This can be used to start more than one copy of jEdit. For example, you can start a new jEdit like so:
$ jedit -server=my-server-2 |
Now any subsequent jEdit instances opened with the -server=my-server-2 parameter will connect to this instance.
All jEdit command line parameters except those that affect initial startup (-nosettings, -settings and -nosplash) are handled appropriately by the server. If the -reuseview switch is specified, the client instance will open files in an existing view, rather than creating a new one.
If you find yourself launching and exiting jEdit often, you can save time by running it in background mode. In background mode, jEdit will stay resident and wait for client requests, even when no views are open. To start jEdit in background mode, specify the -background command line switch. jEdit will then start up normally, except that an initial view will only be created when a client connects.
To completely exit jEdit when running in background mode, you must invoke File>Exit; if you close all open views, jEdit will continue running, waiting for more requests.