This chapter explains how to get started with Oracle XML Developer's Kit (XDK) for Java.
XDK for Java components are included with Oracle Database. This chapter assumes that you installed XDK with Oracle Database and installed the demo programs from the Oracle Database Examples media. For a description of the XDK directory structure, see "Installing XDK".
Example 3-1 lists the main directories under the Oracle home directory for Java (This is the UNIX directory structure.) The contents of the subdirectories are listed individually, after the example.
Example 3-1 Oracle XML Developer's Kit for Java Libraries, Utilities, and Demos
- $ORACLE_HOME
    | - bin/
    | - lib/
    | - jlib/
    | - jdbc/
    | - rdbms/
    | - xdk/
The bin directory contains these components:
         orajaxb
         orapipe
         oraxml
         oraxsl
         transx
The lib directory contains these JAR and ZIP files:
         classgen.jar
         jdev-rt.zip
         oraclexsql.jar
         transx.zip
         xml.jar
         xml2.jar
         xmldemo.jar
         xmlmesg.jar
         xmlparserv2.jar
         xschema.jar
         xsqlserializers.jar
         xsu12.jar
The jlib directory contains these JAR files:
         orai18n.jar
         orai18n-collation.jar
         orai18n-mapping.jar
         orai18n-utility.jar
The jdbc directory contains this lib subdirectory:
         | - lib/
              ojdbc6.jar
The rdbms directory contains this jlib subdirectory:
         | - jlib/
              xdb.jar
And, the xdk directory contains this demo subdirectory:
         | demo/
            | - java/
                 | - classgen/
                 | - jaxb/
                 | - parser/
                 | - pipeline/
                 | - schema/
                 | - transviewer/
                 | - tranxs/
                 | - xsql/
                 | - xsu/
The /xdk/demo/java subdirectories contain sample programs and data files for XDK for Java components. The chapters in Part I, "Oracle XML Developer's Kit for Java" explain how to use these programs to learn about the most important Java features.
See Also:
Table 1-1 for descriptions of individual XDK for Java componentsXDK for Java components are certified and supported with Java Development Kit (JDK) versions 5 and 6. Earlier versions of Java are no longer supported. Figure 3-1 shows the dependencies of XDK for Java components when using JDK 5.
Figure 3-1 Oracle XML Developer's Kit for Java Component Dependencies for JDK 5

XDK for Java components need the libraries in Table 3-1. Some of the libraries are not specific to XDK, but are shared among other Oracle Database components.
Table 3-1 Java Libraries for Oracle XML Developer's Kit for Java Components
| Library | Directory | Includes . . . | 
|---|---|---|
| 
 
  | 
 
  | 
 Extensible Markup Language (XML) class generator for Java runtime classes. Note: This library is maintained only for backward compatibility. Use the Java Architecture for XML Binding (JAXB) class generator in   | 
| 
 
  | 
 
  | 
 Java graphical user interface (GUI) libraries for use when working with the demos with the Java Development Environment (JDE).  | 
| 
 
  | 
 
  | 
 Oracle Java Database Connectivity (JDBC) drivers for Java 6. This Java Archive (JAR) depends on   | 
| 
 
  | 
 
  | 
 Most of the XSQL Servlet classes needed to construct XSQL pages. Note: This JAR is superseded by   | 
| 
 
  | 
 
  | 
 Globalization support for JDK 1.2 or above. It is a wrapper of all other Globalization JARs and includes character set converters. If you use a multibyte character set other than UTF-8, ISO8859-1, or JA16SJIS, then put this archive in your   | 
| 
 
  | 
 
  | 
 Globalization collation features: the   | 
| 
 
  | 
 
  | 
 Globalization locale and character set name mappings: the   | 
| 
 
  | 
 
  | 
 Globalization locale objects: the   | 
| 
 
  | 
 
  | 
 TransX Utility classes. Note: This archive is superseded by   | 
| 
 
  | 
 
  | 
 Classes needed by   | 
| 
 
  | 
 
  | 
 JAXB and Pipeline Processor classes and classes from these libraries: 
  | 
| 
 
  | 
 
  | 
 The visual JavaBeans:   | 
| 
 
  | 
 
  | 
 Support for using XML parser with a language other than English.  | 
| 
 
  | 
 
  | 
 Application programming interfaces (APIs) for: 
 This library includes   | 
| 
 
  | 
 
  | 
 XML Schema classes contained in  Note: This JAR file is retained only for backward compatibility.  | 
| 
 
  | 
 
  | 
 Classes that XSQL Servlet needs for serialized output such as PDF. Note: This archive is superseded by   | 
| 
 
  | 
 
  | 
 Classes that implement XSU. These classes depend on   | 
See Also:
Oracle Database Globalization Support Guide to learn about the Globalization Support libraries
Oracle Database JDBC Developer's Guide to learn about the JDBC libraries
Oracle XML DB Developer's Guide to learn about Oracle XML DB
To set up the XDK for Java environment, do either of the following:
During Oracle Database installation of XDK, manually set the $CLASSPATH (UNIX) or %CLASSPATH% (Windows) environment variables.
When compiling and running Java programs at the command line, set the -classpath option.
Table 3-2 describes the UNIX environment variables that the XDK for Java components need.
Table 3-2 UNIX Environment Variables for Oracle XML Developer's Kit for Java Components
| Variable | Description | 
|---|---|
| 
 
  | 
 Includes: 
.:${CLASSPATHJ}:${ORACLE_HOME}/lib/xmlparserv2.jar:
${ORACLE_HOME}/lib/xsu12.jar:${ORACLE_HOME}/lib/xml.jar
Note: A period (.) to represent the current directory is optional.  | 
| 
 
  | 
 For JDK 5, set: 
CLASSPATHJ=${ORACLE_HOME}/jdbc/lib/ojdbc6.jar:${ORACLE_HOME}/jlib/orai18n.jar
Certain character sets need   | 
| 
 
  | 
 Installation directory for the Java JDK, Standard Edition. Modify the path that links to the Java SDK.  | 
| 
 
  | 
 For OCI JDBC connections: 
${ORACLE_HOME}/lib:${LD_LIBRARY_PATH}
 | 
| 
 
  | 
 
  | 
After setting up the XDK for Java environment on UNIX, you can use the command-line utilities described in Table 3-3.
Table 3-3 Oracle XML Developer's Kit for Java UNIX Utilities
| Executable/Class | Directory/JAR | Description | 
|---|---|---|
| 
 
  | 
 
  | 
 XSQL command-line utility. The script executes the   | 
| 
 
  | 
 
  | 
 XSU command-line utility See Also: "Using the XSU Command-Line Utility"  | 
| 
 
  | 
 
  | 
 JAXB command-line utility See Also: "Using the JAXB Class Generator Command-Line Utility"  | 
| 
 
  | 
 
  | 
 Pipeline command-line utility See Also: "Using the XML Pipeline Processor Command-Line Utility"  | 
| 
 
  | 
 
  | 
 XML parser command-line utility See Also: "Using the XML Parser Command-Line Utility (oraxml)"  | 
| 
 
  | 
 
  | 
 XSLT processor command-line utility  | 
| 
 
  | 
 
  | 
 TransX command-line utility See Also: "Using the TransX Command-Line Utility"  | 
If your environment is set up correctly, then the UNIX shell script in Example 3-2 generates version and usage information for the utilities in Table 3-3.
Example 3-2 Testing the Oracle XML Developer's Kit for Java Environment on UNIX
#!/usr/bin/tcsh echo;echo "BEGIN TESTING";echo echo;echo "now testing the XSQL utility...";echo xsql echo; echo "now testing the XSU utility...";echo java OracleXML echo;echo "now testing the JAXB utility...";echo orajaxb -version echo;echo "now testing the Pipeline utility...";echo orapipe -version echo;echo "now testing the XSLT Processor utility...";echo oraxsl echo;echo "now testing the TransX utility...";echo transx echo;echo "END TESTING"
Table 3-4 describes the Windows environment variables that the XDK for Java components need.
Table 3-4 Windows Environment Variables for Oracle XML Developer's Kit for Java Components
| Variable | Notes | 
|---|---|
| 
 
  | 
 Includes: .;%CLASSPATHJ%;%ORACLE_HOME%\lib\xmlparserv2.jar; %ORACLE_HOME%\lib\xsu12.jar;%ORACLE_HOME%\lib\xml.jar; %ORACLE_HOME%\lib\xmlmesg.jar;%ORACLE_HOME%\lib\oraclexsql.jar Note: A single period "." to represent the current directory is not required, but may be useful.  | 
| 
 
  | 
 For JDK 5, set: CLASSPATHJ=%ORACLE_HOME%\jdbc\lib\ojdbc6.jar:%ORACLE_HOME%\lib\orai18n.jar The   | 
| 
 
  | 
 Installation directory for the Java software developer's kit (SDK), Standard Edition. Modify the path that links to the Java SDK.  | 
| 
 
  | 
 
  | 
After setting up the XDK for Java environment on Windows, you can use the command-line utilities described in Table 3-5.
Table 3-5 Oracle XML Developer's Kit for Java Windows Utilities
| Batch File/Class | Directory/JAR | Description | 
|---|---|---|
| 
 
  | 
 
  | 
 XSQL command-line utility. The batch file executes the   | 
| 
 
  | 
 
  | 
 XSU command-line utility See Also: "Using the XSU Command-Line Utility"  | 
| 
 
  | 
 
  | 
 JAXB command-line utility See Also: "Using the JAXB Class Generator Command-Line Utility"  | 
| 
 
  | 
 
  | 
 Pipeline command-line utility See Also: "Using the XML Pipeline Processor Command-Line Utility"  | 
| 
 
  | 
 
  | 
 XML parser command-line utility See Also: "Using the XML Parser Command-Line Utility (oraxml)"  | 
| 
 
  | 
 
  | 
 XSLT processor command-line utility  | 
| 
 
  | 
 
  | 
 TransX command-line utility See Also: "Using the TransX Command-Line Utility"  | 
If your environment is set up correctly, then you can run the commands in Example 3-3 at the system prompt to generate version and usage information for the utilities in Table 3-5.
To see which version of XDK you have installed, use javac to compile the Java code shown in Example 3-4.
//
// XDKVersion.java
//
import java.net.URL;
import oracle.xml.parser.v2.XMLParser;
public class XDKVersion
{
   static public void main(String[] argv)
   {
      System.out.println("You are using version: ");
      System.out.println(XMLParser.getReleaseVersion());
   }
}
After compilation, run the program on the operating system command line:
java XDKVersion
The result is similar to:
You are using version: Oracle XML Developers Kit 11.1.0.6.0 - Production