SQL/MX Programming Manual for Java
Getting Started
HP NonStop SQL/MX Programming Manual for Java—523726-003
2-5
Setting the Class Path
Setting the CLASSPATH Environment Variable
Use the CLASSPATH environment variable to set the class path for a session during
which you process or execute SQLJ programs. The setting of the CLASSPATH
environment variable persists for the current session.
To set the CLASSPATH environment variable in the OSS environment, enter this
command at an OSS prompt:
path1 and path2 are paths to JAR files or top-level directories where Java classes or
package directories exist. The paths must not include the package name.
To set the class path of the SQLJ product file, sqlj.jar, and JDBC/MX driver,
jdbcMx.jar, use this OSS command line:
export CLASSPATH="/usr/tandem/sqlmx/lib/sqlj.jar:
/usr/tandem/jdbcMx/current/lib/jdbcMx.jar:$CLASSPATH"
The /usr/tandem/sqlmx/lib directory is the default location of the SQLJ product.
The /usr/tandem/jdbcMx/current/lib/jdbcMx.jar is a link to the current
installation of the JDBC/MX driver. For a specific version of the JDBC/MX driver,
current is a symbolic link to the product version subdirectory (for example,
T1225V31).
For more information about the export command, see the Open System Services
Shell and Utilities Reference Manual.
Specifying the java -cp Option
The java -classpath (or -cp) option directs the Java compiler to add a specified
path to the class path while you process an SQLJ program.
During translation and customization, use the -cp option to add the full directory path
of the SQLJ -d option to the class path:
java -cp $CLASSPATH:/usr/dev/mybin sqlj.tools.Sqlj
-d=mybin MyProg.sqlj
For more information about the -d option, see Options for Output Files and Directories
on page 5-18.
During the customization of profiles in a JAR file, use the -cp option to add the JAR
file path to the class path:
java -cp $CLASSPATH:MyApp.jar sqlj.tools.Sqlj MyApp.jar
For more information, see Customizing Profiles in a JAR File on page 6-7.
You can also add the -d option and JAR file paths to the class path by using the
CLASSPATH environment variable. See Setting the CLASSPATH Environment
Variable on page 2-5.
export CLASSPATH=["][$CLASSPATH:]path1[{:path2}...]["]