# Setting up your environment

You need to set several environment variables so that the scripts that are included with the Derby `bin` distribution run correctly. These scripts need to be run in an appropriate command line environment, i.e. a "Command Prompt" on Windows or a shell on Unix.

To set the environment variables:

1. Set the DERBY_HOME environment variable to the location where you extracted the Derby bin distribution. For example, if you installed Derby in the c:\Derby_10 directory on Windows, or the /opt/Derby_10 directory on Unix, use the following command to set the DERBY_HOME environment variable:

   Operating System | Command
   --- | ---
   UNIX | `export DERBY_HOME=/opt/Derby_10`
   Windows | `set DERBY_HOME=c:\Derby_10`

2. Set the JAVA_HOME environment variable. The JAVA_HOME environment variable is used by the scripts to locate the JVM and Java applications.

   Operating System | Command
   --- | ---
   UNIX | `export JAVA_HOME=/usr/j2se`
   Windows | `set JAVA_HOME=C:\Program Files\Java\j2se1.4.2_05`

3. Add the DERBY_HOME/bin directory to the PATH environment variable so that you can run the Derby scripts from any directory.

   Operating System | Command
   --- | ---
   UNIX | `export PATH="$DERBY_HOME/bin:$PATH"`
   Windows | `set PATH=%DERBY_HOME%\bin;%PATH%`

   When the DERBY_HOME environment variable is set and the underlying bin directory is included in the PATH environment variable, you can use shortened commands to start the Derby tools.
4. Verify that the DERBY_HOME and the JAVA_HOME environment variables are set correctly, and that the DERBY_HOME/bin directory is added to the PATH environment variable. Use the following command to check the settings:

       sysinfo

   If the environment variables are set correctly, the sysinfo command displays information about your JVM and the version of Derby you have installed.

For more information on the scripts included in the bin distribution, see Scripts included with Derby.
Parent topic: Installing and working with Derby
Related concepts
Installing Java DB
Using the Derby tools and startup utilities
Related tasks
Setting the classpath