Setting the Module Path or Class Path for Java Development
Compiling any Java application requires the appropriate JARs to be in your module path or class path.
Java Development Kit
Before running a Java program that loads any of the TimesTen JDBC drivers, configure the JDK library file and path in your Java runtime environment. In Java, class path and module path both tell the JVM and compiler where to find code.
For JDK 11, 17, 21, and 25, the TimesTen JDBC JAR is
timesten_home/install/lib/ttjdbcjdk_version.jar,
where jdk_version indicates the JDK version,
11, 17, 21, or 25, for example, ttjdbc25.jar for
JDK 25. The JAR is also packaged as a Java module with the Java
module name, timesten.jdbc, so you can use it for
module compilation.
The tables below summarize the supported ways to compile and run applications, including both modular and non-modular usage. The options differ slightly between JDK 25 and JDK 11-21.
Table 1-1 JDK 25: Using the TimesTen JDBC Module
| Option | Description | Compile Command | Run Command |
|---|---|---|---|
|
Option 1: Modular application |
Add |
javac
--module-path <progname>.java
module-info.javawhere:
The following example shows a
sample |
java
--module-path $module_path
--enable-native-access=timesten.jdbc" --module
$name_of_module/$classnamewhere:
|
|
Option 2: Non-modular or mixed application |
If your application is not a module or it uses JARs that are not packaged as Java modules, add the JARs that are modules to the module path and continue to use classpath for the rest of the non-module dependencies. |
javac -cp
$CLASSPATH --module-path $module_path …where |
java -cp
$CLASSPATH --module-path $module_path
--enable-native-access="timesten.jdbc"
… |
Note:
Every time you want to compile a modular application the classes
must have a package name ($classname ).
Table 1-2 JDK 11, 17, 21: Using the TimesTen JDBC Module or Classpath
| Option | Description | Compile Command | Run Command |
|---|---|---|---|
|
Option 1: Modular application |
Add
|
javac
--module-path $module_path …where |
java
--module-path $module_path
--enable-native-access="timesten.jdbc"
…For JDK 11, exclude
java
--module-path $module_path … |
|
Option 2: Non-modular or mixed application |
If your application is not a module or it uses JARs that are not packaged as Java modules, add the JARs that are modules to the module path and continue to use classpath for the rest of the non-module dependencies. |
javac -cp
$CLASSPATH --module-path $module_path …where |
java -cp
$CLASSPATH --module-path $module_path
--enable-native-access="timesten.jdbc"
… |
|
Option 3: Legacy classpath |
Add
|
javac -cp
$CLASSPATH …where
|
java -cp
$CLASSPATH … |
Java Environment Variables in Oracle TimesTen In-Memory Database Installation,
Migration, and Upgrade Guide discusses the
CLASSPATH setting for compiling Java
applications in TimesTen.
JMS/XLA Applications
Compiling any JMS/XLA application requires the following to be in your classpath:
| JMS Type | Classpath Entries |
|---|---|
| Jakarta | timesten_home/install/lib/timestenjmsxla.jar
timesten_home/install/lib/orai18n.jarIn Installing TimesTen and Supported Java Components, you downloaded the Jakarta JMS JAR. You need to add the location of the JAR to your classpath: download-directory/jakarta.jms-api-3.1.0.jar |
| JavaX | timesten_home/install/lib/timestenjmsxla.jar
timesten_home/install/lib/orai18n.jar
timesten_home/install/3rdparty/jms1.1/lib/jms.jar |
timestenjmsxla.jar is for use with both
Jakarta JMS and JavaX JMS, but note
download-directory/jakarta.jms-api-3.1.0.jar
in the classpath determines Jakarta JMS and
download-directory/install/3rdparty/jms1.1/lib/jms.jar
in the classpath determines JavaX JMS. If both JARs are in the
classpath, TimesTen defaults to Jakarta JMS.
When running your modular JMS/XLA application, you can add
the above timestenjmsxla.jar path to the module
path and add the module name timesten.jdbc to
--enable-native-access option.
java --module-path $module_path
--enable-native-access="timesten.jdbc,timesten.jmsxla"
where $module_path is the module path that
includes
timesten_home/install/lib/ttjdbcjdk_version.jar
and
timesten_home/install/lib/timestenjmsxla.jar:existing_path_to_modules.
Classpath Entry for ttenv
Use the appropriate ttenv script to set your
environment, as discussed in Setting the Environment for Java Development.
Note:
-
For each TimesTen instance, the
timesten_home/installpath is a symbolic link toinstallation_dir, where TimesTen is installed. -
On Windows, there is only one TimesTen instance per installation, and
timesten_homerefers toinstallation_dir\instance.