Manually setting the CLASSPATH/MODULEPATH environment variables You can set the CLASSPATH and MODULEPATH environment variables in the operating system either temporarily, permanently, or at run time when you start your Java application and the JVM. classpathsettingenvironment variablesCLASSPATHscriptssetEmbeddedCP scriptssetNetworkServerCPscriptssetNetworkClientCP

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

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

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

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

setEmbeddedCP
Use the setEmbeddedCP script to set CLASSPATH and MODULEPATH when the database engine is used in embedded mode.
setNetworkServerCP
Use the setNetworkServerCP script to set CLASSPATH and MODULEPATH when you want to start the network server.
setNetworkClientCP
Use the setNetworkClientCP script to set CLASSPATH and MODULEPATH when you want to access databases using the network client.

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

Note that these scripts behave slightly differently on UNIX systems and on Windows systems. On Windows systems, running the script in your command shell will set the environment variables for your shell.

On UNIX systems, you need to use the "dot" or "source" command to ensure that the script is run in the calling shell's environment. Otherwise, when a script is run, it launches a new shell for that script. The CLASSPATH and MODULEPATH variables are set within that shell. Once the script is complete, that shell exits and you are returned to your shell. CLASSPATH/MODULEPATH are changed only for the shell that the script was running in. The CLASSPATH and MODULEPATH variables in your shell are unchanged.

The UNIX shell scripts are known to run successfully in the Bash shell, and you may need to modify them slightly if you are using a different UNIX shell.

Here are examples of running the scripts, then displaying the classpath that the script sets:

  • On UNIX, using the "dot" command to invoke the script, a sample session might be as follows: sh-2.05b$ echo $CLASSPATH sh-2.05b$ DERBY_HOME=/derby/db-derby-10.X.Y.0-bin sh-2.05b$ . $DERBY_HOME/bin/setEmbeddedCP sh-2.05b$ echo $CLASSPATH /derby/db-derby-10.X.Y.0-bin/lib/derbyshared.jar:/derby/db-derby-10.X.Y.0-bin/lib/derby.jar:/derby/db-derby-10.X.Y.0-bin/lib/derbytools.jar:/derby/db-derby-10.X.Y.0-bin/lib/derbyoptionaltools.jar: sh-2.05b$ java org.apache.derby.tools.ij ij version 10.X ij> quit;
  • On UNIX, using the "source" command to invoke the script, a sample session might be as follows: -bash-2.05b$ echo $CLASSPATH -bash-2.05b$ export DERBY_HOME=/derby/db-derby-10.X.Y.0-bin -bash-2.05b$ source $DERBY_HOME/bin/setEmbeddedCP
  • On Windows, a sample session might be as follows: C:\derby\db-derby-10.X.Y.0-bin\bin>echo %CLASSPATH% %CLASSPATH% C:\derby\db-derby-10.X.Y.0-bin\bin>set DERBY_HOME=C:\derby\db-derby-10.X.Y.0-bin C:\derby\db-derby-10.X.Y.0-bin\bin>setEmbeddedCP.bat C:\derby\db-derby-10.X.Y.0-bin\bin>echo %CLASSPATH% C:\derby\DB-DERBY-10.X.Y.0-bin\lib\derbyshared.jar;C:\derby\DB-DERBY-10.X.Y.0-bin\lib\derby.jar;C:\derby\DB-DERBY-10.X.Y.0-bin\lib\derbytools.jar;C:\derby\DB-DERBY-10.X.Y.0-bin\lib\derbyoptionaltools.jar; C:\derby\db-derby-10.X.Y.0-bin\bin>java org.apache.derby.tools.ij ij version 10.X ij> quit;

For more information on running the ij and sysinfo utilities, see the