Chapter 8.
Setting Up the JDK Environment
There is nothing special about setting up your Java environment for developing with the Oracle XDK and Oracle Database 10g. You should note that when installing an Oracle Home, no changes are made to your CLASSPATH settings even though significant Java functionality is being used. This is because Oracle Java applications are invoked with their required CLASSPATHs on the command line or in a script.
While the Oracle database requires you to manually set the CLASSPATH, the OTN XDK distribution supplies an env.bat file on Windows and an env.csh file on UNIX to automate the setup of your environment and serve as a template for customizations. These files need certain variables set in order to create a working environment. Tables 13-1 and 13-2 provide the definitions on Windows and UNIX, respectively, for the various JDK versions.
Variable Name | Values | Customize |
---|---|---|
%INSTALL_ROOT% | Installation root of XDK, which is the directory we refer to as %XDK_HOME%. | NO |
%JAVA_HOME% | Directory where the Java SDK, Standard Edition is installed. Path linked to the Java SDK needs to be modified. | YES |
%CLASSPATHJ% | For 1.2 and 1.3: CLASSPATHJ=%ORACLE_HOME%\jdbc\lib\classes12.jar; %ORACLE_HOME%\jdbc\lib\orai18n.jar For 1.2 and 1.3: CLASSPATHJ=%ORACLE_HOME%\jdbc\lib\ojdbc14.jar; %ORACLE_HOME%\jdbc\lib\orai18n.jar | YES |
%PATH% | PATH=%JAVA_HOME%\bin;%ORACLE_HOME%\bin; %PATH%;%INSTALL_ROOT%\bin | NO |
%CLASSPATH% | %CLASSPATHJ%;%INSTALL_ROOT%\lib\xmlparserv2.jar; %INSTALL_ROOT%\lib\xsu12.jar; %INSTALL_ROOT%\lib\xml.jar; | NO |
Variable Name | Values | Customize |
---|---|---|
$INSTALL_ROOT | Installation root of XDK, which is the directory we refer to as $XDK_HOME. | NO |
$JAVA_HOME | Directory where the Java SDK, Standard Edition is installed. Path linked to the Java SDK needs to be modified. | YES |
$CLASSPATHJ | For 1.2 and 1.3: CLASSPATHJ=${ORACLE_HOME}\jdbc\lib\classes12.jar; ${ORACLE_HOME}\jdbc\lib\orai18n.jar For 1.2 and 1.3: CLASSPATHJ=${ORACLE_HOME}\jdbc\lib\ojdbc14.jar; ${ORACLE_HOME}\jdbc\lib\orai18n.jar | YES |
$PATH | PATH=$JAVA_HOME\bin; $PATH;${INSTALL_ROOT}\bin | NO |
$CLASSPATH | .;$CLASSPATHJ;${INSTALL_ROOT}\lib\xmlparserv2.jar; ${INSTALL_ROOT}\lib\xsu12.jar; ${INSTALL_ROOT}\lib\xml.jar; | NO |
$LD_LIBRARY_PATH | For OCI JDBC connections: ${ORACLE_HOME}/lib:${LD_ LIBRARY_PATH} | NO |
Using env.bat as an example, if you have %JAVA_HOME% and %ORACLE_HOME% set up in your environment and you use JDK 1.4, which is suggested for use with Oracle XDK 10g, you can simply go to the %XDK_HOME%/bin directory and run env.bat. The batch file will set the PATH environment variable so that you can run the command-line executables provided along with the XDK. Additionally, the batch file sets the Java CLASSPATH variable, which includes ojdbc14.jar, orai18n.jar, xmlparserv2.jar, xml.jar, xmlmesg.jar, xsu12.jar, and oraclexsql.jar.