Description: You can set the CLASSPATH environment variable in the operating system either temporarily, permanently, or at run time when you start your Java application and the JVM.
Keywords: classpath, setting, environment variables, CLASSPATH, scripts, setEmbeddedCP, setNetworkServerCP, setNetworkClientCP

# Manually setting the CLASSPATH environment variable

You can set the CLASSPATH environment variable in the operating system either temporarily, permanently, or at run time when you start your Java application and the JVM.

The classpath is a list of the class libraries that are needed by the JVM and other Java applications to run your program. There are scripts that are included with Derby that can set up the classpath to run the Derby tools.

If you want to call the Derby tools directly using Java and not using the scripts, you must manually set the CLASSPATH environment variable.

In most development environments, it is best to temporarily set the CLASSPATH environment variable in the command line shell where you are entering commands.

Derby provides several scripts in the DERBY_HOME/bin directory to help you set your classpath quickly. These scripts are:

setEmbeddedCP
  Use the setEmbeddedCP script to set the classpath when the database engine is used in embedded mode. This script adds the derby.jar and derbytools.jar files to the classpath.
setNetworkServerCP
  Use the setNetworkServerCP script to set the classpath when you want to start the network server. This script adds the derbynet.jar file to the classpath.
setNetworkClientCP
  Use the setNetworkClientCP script to set the classpath when you want to access databases using the network client. This script adds the derbyclient.jar and derbytools.jar files to the classpath.

To set the classpath temporarily, run the script that is appropriate for your environment every time that you open a new command window.

To see the classpath that the script sets, issue the following command after you run the script:

- On UNIX, use `echo $CLASSPATH`
- On Windows, use `echo %CLASSPATH%`

For more information on running the `ij` and `sysinfo` utilities, see the Java DB Tools and Utilities Guide
Parent topic: Setting up your environment