Setting the classpath

The classpath is a list of the class libraries that are needed by the JVM and other Java applications to run your program. The scripts that are included with Derby set up their own classpath for running the tools. However, to call the tools directly using Java and not using the scripts, you need to manually set 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.

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
The setEmbeddedCP script adds the derby.jar and derbytools.jar files to the classpath, when the database engine is used in embedded mode.
setNetworkServerCP
The setNetworkServerCP script adds the derby.jar and derbynet.jar files to the classpath, so that you can start the network server.
setNetworkClientCP
The setNetworkClientCP script adds the derbyclient.jar and derbytools.jar files to the classpath, so that you can access databases using the network client.

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 Derby Tools and Utilities Guide
Related concepts
Using the sysinfo tool
Related tasks
Setting up your environment
Running ij