Skip Headers
Oracle® Database Java Developer's Guide
10g Release 2 (10.2)

Part Number B14187-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

4 Java Installation and Configuration

This chapter describes how to install and configure of the Oracle Java virtual machine (JVM). It also describes how to enable the Java client. This chapter covers the following topics:

Initializing a Java-Enabled Database

If you install Oracle Database with the Oracle JVM option, then the database is Java-enabled. That is, it is ready to run Java stored procedures, Java Database Connectivity (JDBC), and SQLJ.

This section contains the following topics:

Configuring with Oracle Database Template

Configure the Oracle JVM option within the database template. This is the recommended method for Java installation.

The Database Configuration Assistant enables you to create database templates for defining what each database instance installation will contain. Choose the Oracle JVM option to have the Java platform installed within your database.

Modifying an Existing Oracle Database to Include Oracle JVM

If you have already installed Oracle Database without Oracle JVM, then you can add Java to your database through the modify mode of the Database Configuration Assistant of Oracle Database 10g. The modify mode enables you to choose the features, such as Oracle JVM, that you would like to install on top of an existing Oracle Database instance.

Configuring Oracle JVM

Before you install Oracle JVM as part of your normal Oracle Database installation, you need to ensure that the configuration requirements for Oracle JVM are fulfilled. The main configuration for Java classes within Oracle Database includes configuring the:

Using The DBMS_JAVA Package

Installing Oracle JVM creates the DBMS_JAVA PL/SQL package. Some entry points of DBMS_JAVA are for external use. That is, these entry points are used by developers. Other entry points are only for internal use. The corresponding Java class, DbmsJava, provides methods for accessing database functionality from Java.

Enabling the Java Client

To run Java between the client and server, your must perform the following:

  1. Install J2SE on the Client

  2. Set Up Environment Variables

  3. Test Install with Samples

Install J2SE on the Client

The client requires Java Development Kit (JDK) 1.4.2 or later. To confirm the version of JDK you are using, run the following commands on the command line:

$ which java
/usr/local/j2se1.4.2/bin/java

$ which javac
/usr/local/j2se1.4.2/bin/javac

$ java -version
java version "1.4.2"

Set Up Environment Variables

After installing JDK on your client, add the directory path to the following environment variables:

  • $JAVA_HOME

    This variable must be set to the top directory of the installed JDK base.

  • $PATH

    This variable must include $JAVA_HOME/bin.

  • $LD_LIBRARY_PATH

    This variable must include $JAVA_HOME/lib.

JAR Files Necessary for Java2 Clients

To ensure that the Java client successfully communicates with the server, include the following files in the CLASSPATH:

  • For JDK 1.4.2, include $JAVA_HOME/lib/dt.jar

  • For JRE 1.4.2, include $JAVA_HOME/lib/rt.jar

  • For any interaction with JDBC, include $ORACLE_HOME/jdbc/lib/classes12.zip

  • For any client that uses SSL, include $ORACLE_HOME/jlib/jssl-1_2.jar and $ORACLE_HOME/jlib/javax-ssl-1_2.jar

  • For any client that uses the Java Transaction API (JTA) functionality, include $ORACLE_HOME/jlib/jta.jar

  • For any client that uses the Java Naming and Directory Interface (JNDI) functionality, include $ORACLE_HOME/jlib/jndi.jar

  • If you are using the accelerator for native compilation, include $JAVA_HOME/lib/tools.jar

JAR Files Included for Clients that use SQLJ

You must include the $ORACLE_HOME/sqlj/lib/translator.zip file for SQLJ.

In addition to this file, add the appropriate runtimeX.zip file, as follows:

  • For a Java client using the current release of JDBC, include $ORACLE_HOME/sqlj/lib/runtime12.zip

  • For a Java2 Platform, Enterprise Edition (J2EE) client using the current release of JDBC, include $ORACLE_HOME/sqlj/lib/runtime12ee.zip

  • For any JDK client using JDBC 8.1.7 or earlier version, include $ORACLE_HOME/sqlj/lib/runtime.zip

Server Application Development on the Client

If you develop and compile your server applications on the client and want to use the same Java Archive (JAR) files that are loaded on the server, then include $ORACLE_HOME/lib/aurora.zip in CLASSPATH. This is not required for running Java clients.

Test Install with Samples

When you install Oracle Database with the Oracle JVM option, a set of samples is also installed and available in the $ORACLE_HOME/javavm/demo directory. These samples can be compiled and run as a test of your installation.

If these samples do not compile or run, then the environment may be incorrectly set. Similarly, if these samples compile and run, but a code written by you does not, then a problem exists within the build environment or code.

Note:

When verifying your installation, it is important that you run these examples using the supplied makefiles.

Verify that the samples work before using more complex build environments, such as Visual Cafe, JDeveloper, or VisualAge.