# Starting jEdit

Exactly how jEdit is started depends on the operating system. For example, on Unix you can run jedit at the command line, or select jEdit from a menu; on Windows, you can double-click on the jEdit icon or select it from the Start menu.

If jEdit is started while another copy is already running, control is transferred to the running copy, and a second instance is not loaded. This saves time and memory if jEdit is started multiple times. Communication between instances of jEdit is implemented using TCP/IP sockets; the initial instance is known as the server, and subsequent invocations are clients.

If you find yourself launching and exiting jEdit a lot, the startup time can get a bit bothersome. If the `-background` command line switch is specified, jEdit will continue running and waiting for client requests even after all editor windows are closed. When run in background mode, you can open and close jEdit any number of times, only having to wait for it to start the first time. The downside of this is increased memory usage.

When running on MacOS X, the `-background` command-line switch is active by default, so that jEdit conforms to the platform convention that programs should stay open until the Quit command is explicitly invoked by the user, even if all windows are closed. To disable background mode on MacOS X, use the `-nobackground` switch.

For more information about command line switches that control the server feature, see .

jEdit remembers open buffers, views and split window configurations between editing sessions, so you can get back to work immediately after starting jEdit. This feature can be disabled in the General pane of the Utilities>Options dialog box see .

The edit server and security

Since Java does not provide any interprocess communication facility other than TCP/IP, jEdit takes extra precautions to prevent remote attacks.

Not only does the edit server pick a random TCP port number on startup, it also requires that clients provide an authorization key; a randomly-generated number only accessible to processes running on the local machine. So not only will bad guys have to guess a 64-bit integer, they will need to get it right on the first try; the edit server shuts itself off upon receiving an invalid packet.

In environments that demand absolute security, the edit server can be disabled by specifying the `-noserver` command line switch.

## Command Line Usage

On operating systems that support a command line, jEdit can be passed various arguments to control its behavior.

When opening files from the command line, a line number or marker to position the caret on can be specified like so:

    $ jedit MyApplet.java +line:10
    $ jedit thesis.tex +marker:c

Command-line switches begin with a "-". Some take a parameter. A file whose name begins with "-" can be opened like so:

    $ jedit -- -myfile

### Miscellaneous Options

Option | Effect
--- | ---
`-log=level` | Set the minimum log level to an integer between 1 and 9. Default is 7. Has no effect when connecting to another instance via the edit server.
`-usage` | Show a brief command line usage message without starting jEdit. This message is also shown if an invalid switch was specified.
`-version` | Show the version number without starting jEdit.
`-nosplash` | Don't show the splash screen on startup.
`--` | Specifies the end of command-line processing. Further parameters are treated as file names, even if they begin with a dash.

### Configuration Options

Option | Effect
--- | ---
`-plugins` | Enable loading of plugins. Has no effect when connecting to another instance via the edit server. See .
`-noplugins` | Disable loading of plugins. Has no effect when connecting to another instance via the edit server.
`-restore` | Restore previously open files on startup. This is the default. This feature can also be set permanently in the General pane of the Utilities> Options dialog box; see .
`-norestore` | Do not restore previously open files on startup.
`-run=script` | Run the specified BeanShell script. There can only be one of these parameters on the command line. See .
`-settings=dir` | Store user-specific settings in the directory named dir, instead of the default `user.home/.jedit`. The directory will be created automatically if it does not exist. Has no effect when connecting to another instance via the edit server. See .
`-nosettings` | Start jEdit without loading user-specific settings.
`-startupscripts` | Run startup scripts. This is the default. Has no effect when connecting to another instance via the edit server. See .
`-nostartupscripts` | Disable startup scripts. Has no effect when connecting to another instance via the edit server.

### Edit Server Options

See for a brief description of the edit server.

Option | Effect
--- | ---
`-background` | Run jEdit in background mode. In background mode, the edit server will continue listening for client connections even after all views are closed. Has no effect when connecting to another instance via the edit server.
`-nobackground` | Disable background mode. This is the default. Has no effect when connecting to another instance via the edit server.
`-gui` | Open an initial view. This is the default. Has no effect when connecting to another instance via the edit server.
`-nogui` | Do not open an initial view, and instead only open one when the first client connects. Can only be used in combination with the `-background` switch. You can use this switch to pre-load jEdit when you log in to your computer, for example. Has no effect when connecting to another instance via the edit server.
`-newplainview` | Opens the specified files in a new plain view. For more information about views, see .
`-newview` | Opens the specified files in a new view.
`-reuseview` | Opens the specified files in an existing view.
`-quit` | Exits the currently running editor instance.
`-server` | Store the server port info in the file named `server` inside the settings directory.
`-server=name` | Store the server port info in the file named name. File names for this parameter are relative to the settings directory.
`-noserver` | Do not attempt to connect to a running edit server, and do not start one either.
`-wait` | Keeps the client open until the user closes the specified buffer in the server instance. Does nothing if passed to the initial jEdit instance. Use this switch if jEdit is being invoked by another program as an external editor; otherwise the client will exit immediately and the invoking program will assume you have finished editing the given file.

## Java Virtual Machine Options

To enable AntiAliasing in the TextArea, see .

It is possible to pass command line options to the Java Virtual Machine (JVM). These options can change certain things about how Java runs, such as the maximum heap size, or whether antialiasing is used in certain places.

For operating systems such as Linux where jEdit is started via a shell script, you can easily edit the `jedit` script and place JVM arguments in the correct place. If you are using the `-jar` command line option with the `java` command to run jEdit (which is how the default shell scripts do it), remember that the `-jar` parameter must be the last `java` option, followed immediately by the path to `jedit.jar` and then any jEdit command line options.

On a Windows install that uses `jEdit.exe`, the JVM options are located in a separate file, called `jEdit.l4j.ini`. Create or edit this file in the same directory as `jEdit.exe` and place one JVM option per line.

On Mac OS X, the jEdit.app bundle gets JVM options from a file called `Contents/Info.plist`, which can be edited with a text editor.

There is no complete list of options to `java`, since it can vary from one platform to another. Some of can be found by typing the commands `java -?` or `man java`. Common JVM options that are used with jEdit and work on all platforms are:

Option | Effect
--- | ---
`-Dawt.useSystemAAFontSettings=on` | Antialias the text in AWT components.
`-Dswing.aatext=true` | Antialias the text in Swing components.
`-Djedit.home=/path/to/jedit` | Sets/overrides the java System property `jedit.home` to be the path to the jEdit install. This tells jEdit where to find its site properties, default keymaps, macros, edit modes, and documentation. You can override this setting to create a custom install that is shared by multiple users. See for more information.
`-mx768m` | Sets maximum heap size to 768 megabytes. Adjust this value depending on your own personal needs / plugins. On at least one platform, `-Xmx768m` works when `-mx768m` does not (or vice-versa).