IBM Support

Specifying CLASSPATH and LIBPATH for a Content Manager OnDemand Web Enablement Kit (ODWEK) application on IBM i

How To


Summary

When running an ODWEK application on IBM i, the methods for setting the Java CLASSPATH and LIBPATH (Native Library Path) depend on whether the ODWEK application is called by using a CL command, QSHELL command, PASE command, or an application server such as WebSphere Application Server (WAS).

Steps

In the following examples, replace your_path with the Integrated File System (IFS) directory that contains your ODWEK application, and replace the ellipsis () with the specification for your application class name or jar file and associated parameters. ODWEK is dependent on several jar files that are shipped in the IFS directory named /QIBM/ProdData/OnDemand/jars. The class path values in the following examples use the wildcard character (*) to specify all jar files in that directory. If you want to ensure that ODWEK uses only the specific jar files that it is dependent on, you can replace the wildcard portion of the class path value in the examples with the jar file names provided in the Read This First document for the version of Content Manager OnDemand that you are using. See the Related information link for access to the Read This First documents.
Important note:  The LIBPATH value of /QIBM/ProdData/OnDemand/lib64 in the following examples is supported at server version 10.5.0.8 or later. A LIBPATH value of /QSYS.LIB/QRDARS.LIB is supported on all versions. 
Calling the ODWEK application by using QSHELL or PASE
For CLASSPATH:
When running Java in QSHELL or PASE, the CLASSPATH value can be specified with the following export command (entered as a single command with no spaces or line breaks between the colon-separated class path values):
export CLASSPATH=/QIBM/ProdData/OnDemand/www/api/ODApi.jar:
/QIBM/ProdData/OnDemand/jars/*:your_path
or on the java -classpath or -cp option. For example (entered as a single command with no spaces or line breaks between the colon-separated class path values):
java -cp /QIBM/ProdData/OnDemand/www/api/ODApi.jar:
/QIBM/ProdData/OnDemand/jars/*:your_path ...

For LIBPATH:
When running Java in QSHELL or PASE, the library path is specified by using the LIBPATH environment variable with the following export command:
export LIBPATH=/QIBM/ProdData/OnDemand/lib64
or you can specify the library path on the java command by using the -Djava.library.path parameter:
java -Djava.library.path=/QIBM/ProdData/OnDemand/lib64 ...
For CLASSPATH and LIBPATH:
You can also specify both the class path and library path at the same time. For example (entered as a single command with no spaces or line breaks between the colon-separated class path values):
java -cp /QIBM/ProdData/OnDemand/www/api/ODApi.jar:
/QIBM/ProdData/OnDemand/jars/*:your_path 
-Djava.library.path=/QIBM/ProdData/OnDemand/lib64 ...
Calling the ODWEK application by using a CL command
For CLASSPATH:
When running Java by calling the JAVA CL command, the class path can be specified directly on the CLASSPATH parameter. For example (entered as a single command with no spaces or line breaks between the colon-separated class path values):
JAVA CLASSPATH('/QIBM/ProdData/OnDemand/www/api/ODApi.jar:
/QIBM/ProdData/OnDemand/jars/*:your_path') ... 
or by using an environment variable. For example (entered as a single command with no spaces or line breaks between the colon-separated class path values, and then the last line issued as a separate command):
ADDENVVAR ENVVAR(CLASSPATH) VALUE('/QIBM/ProdData/OnDemand/www/api/ODApi.jar:
/QIBM/ProdData/OnDemand/jars/*:your_path') 
JAVA CLASSPATH(*ENVVAR) ...
For LIBPATH:
When running Java by calling the JAVA CL command, the library path is specified on the PROP parameter. For example:
JAVA PROP((java.library.path '/QIBM/ProdData/OnDemand/lib64')) ...

For CLASSPATH and LIBPATH:
You can also specify both the class path and library path at the same time. For example (entered as a single command with no spaces or line breaks between the colon-separated class path values):
JAVA CLASSPATH('/QIBM/ProdData/OnDemand/www/api/ODApi.jar:
/QIBM/ProdData/OnDemand/jars/*:your_path') 
PROP((java.library.path '/QIBM/ProdData/OnDemand/lib64')) ...

Calling the application by using an application server
Refer to the application server documentation to determine how to specify the CLASSPATH and LIBPATH values. It might work to specify CLASSPATH and LIBPATH as system-wide environment variables, but that is not recommended since that might affect other Java applications.

Related Information

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB10","label":"Data and AI"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSB2EG","label":"Content Manager OnDemand for i"},"ARM Category":[{"code":"a8m0z0000001gP1AAI","label":"technote"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]

Document Information

Modified date:
24 April 2024

UID

ibm17107340