# Starting ij

Derby provides batch and shell scripts for users in Windows and UNIX environments that can be used to start `ij`.

By calling the appropriate script, you can start `ij` and be able to connect with a simple command. The scripts are found in the `bin` directory of your Derby installation. You can also customize the `ij` scripts to suit your environment.

If you are using Derby as a client/server environment, start the Network Server before connecting to the Derby database. (See "Starting the Network Server" in the Derby Server and Administration Guide for details.) You can start `ij` by running the `ij` scripts for your environment. Follow the instructions in "Setting up your environment" in Getting Started with Derby to set the `DERBY_HOME` and `JAVA_HOME` environment variables and to add `DERBY_HOME/bin` to your path. Then use the following command:

    ij [-p propertyFile] [inputFile]

Alternatively, set the `DERBY_HOME` environment variable, then use one of these commands:

    (UNIX) java [options] -jar $DERBY_HOME/lib/derbyrun.jar ij
        [-p propertyFile] [inputFile]

    (Windows) java [options] -jar %DERBY_HOME%\lib\derbyrun.jar ij
        [-p propertyFile] [inputFile]

    java [options] org.apache.derby.tools.ij
        [-p propertyFile] [inputFile]

If you use the last form of the command, be sure that `derbyrun.jar` is in your classpath.

If you need to use other classes in addition to `derbyrun.jar`, you cannot use the `-cp` argument or the `CLASSPATH` environment variable to set `CLASSPATH` variables when you are using the `-jar` argument to start the `ij` tool. If you want to run the `ij` tool with a custom classpath, you cannot use the `-jar` argument. Instead, you have to use the full class name to start the `ij` tool (`java org.apache.derby.tools.ij`).

The command line items are:

- `java`

  Start the JVM.

- `options`

  The options that the JVM uses. You can use the `-D` option to set `ij` properties (see Starting ij using properties) or system properties, such as Derby properties.

- `propertyFile`

  A file you can use to set `ij` properties (instead of the `-D` option). The property file should be in the format created by the `java.tools.Properties.save` methods, which is the same format as the `derby.properties` file.

- `inputFile`

  A file from which to read commands. The `ij` tool exits at the end of the file or an `exit` command. Using an input file causes `ij` to print out the commands as it runs them. If you reroute standard input, `ij` does not print out the commands. If you do not supply an input file, `ij` reads from the standard input.

For detailed information about `ij` commands, see ij commands and errors reference.

Parent topic: Using ij
Related concepts
Getting started with ij
Related tasks
Creating a database using ij
Starting ij using properties