Oracle® XML Developer's Kit Programmer's Guide, 11g Release 2 (11.2) Part Number E10708-01 |
|
|
View PDF |
This chapter contains these topics:
The Java XDK components are included with Oracle Database. This chapter assumes that you have installed XDK with Oracle Database and also installed the demo programs on the Oracle Database Examples media. Refer to "Installing the XDK" for installation instructions and a description of the XDK directory structure.
Example 3-1 shows the UNIX directory structure for the XDK demos and the libraries used by the XDK components. The $ORACLE_HOME/xdk/demo/java
subdirectories contain sample programs and data files for the XDK for Java components. The chapters in Part I, "XDK for Java" explain how to understand and use these programs.
Example 3-1 Java XDK Libraries, Utilities, and Demos
- Oracle_home_directory | - bin/ orajaxb orapipe oraxml oraxsl transx | - lib/ classgen.jar jdev-rt.zip oraclexsql.jar transx.zip xml.jar xml2.jar xmlcomp.jar xmlcomp2.jar xmldemo.jar xmlmesg.jar xmlparserv2.jar xschema.jar xsqlserializers.jar xsu12.jar | - jlib/ orai18n.jar orai18n-collation.jar orai18n-mapping.jar orai18n-utility.jar | - jdbc/ | - lib/ ojdbc5.jar | - rdbms/ | - jlib/ xdb.jar
| - xdk/ | demo/ | - java/ | - classgen/ | - jaxb/ | - parser/ | - pipeline/ | - schema/ | - transviewer/ | - tranxs/ | - xsql/ | - xsu/
The subdirectories contain sample programs and data files for the Java XDK components. The chapters in Part I, "XDK for Java" explain how to use these programs to gain an understanding of the most important Java features.
The Java XDK components are certified and supported with JDK version 5 and version 6. Earlier versions of Java are no longer supported. Figure 3-1 shows the dependencies of Java XDK components when using JDK 5.
Figure 3-1 Java XDK Component Dependencies for JDK 5
The Java XDK components require the libraries alphabetically listed in Table 3-1. Note that some of the libraries are not specific to the XDK, but are shared among other Oracle Database components.
Table 3-1 Java Libraries for XDK Components
Library | Directory | Includes . . . |
---|---|---|
|
|
XML class generator for Java runtime classes. Note: This library is maintained for backward compatibility only. You should use the JAXB class generator in |
|
|
Java GUI libraries for use when working with the demos with the JDeveloper IDE. |
|
|
Oracle JDBC drivers for Java 5, 6. This JAR depends on |
|
|
Most of the XSQL Servlet classes needed to construct XSQL pages. Note: This archive 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 place 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 replaced by |
|
|
Classes needed by |
|
|
Classes from the following libraries:
The archive also contains the JAXB and Pipeline Processor classes. |
|
|
XML JavaBeans that do not depend on the database: Note: This archive is included for backward compatibility only because its classes are included in |
|
|
XML JavaBeans that depend on the database: Note: This JAR is included for backward compatibility only because its classes are included in |
|
|
The visual JavaBeans: |
|
|
Needed if you use XML parser with a language other than English. |
|
|
APIs for the following:
This library includes |
|
|
Includes the XML Schema classes contained in Note: This JAR file is maintained for backward compatibility only. |
|
|
Serializer classes for XSQL Servlet needed for serialized output such as PDF. Note: This archive is superseded by |
|
|
Classes that implement XSU. These classes have a dependency on |
See Also:
Oracle Database Globalization Support Guide to learn about the Globalization Support libraries
Oracle Database JDBC Developer's Guide and Reference to learn about the JDBC libraries
Oracle XML DB Developer's Guide to learn about XML DB
In the Oracle Database installation of the XDK, you must manually set the $CLASSPATH
(UNIX) or %CLASSPATH%
(Windows) environment variables. Alternatively, set the -classpath
option when compiling and running Java programs at the command line.
This section contains the following topics:
Table 3-2 describes the UNIX environment variables required for use with the Java XDK components.
Table 3-2 UNIX Environment Settings for Java XDK Components
Variable | Description |
---|---|
|
Includes the following (note that a single period "." to represent the current directory is not required but may be useful): .:${CLASSPATHJ}:${ORACLE_HOME}/lib/xmlparserv2.jar: ${ORACLE_HOME}/lib/xsu12.jar:${ORACLE_HOME}/lib/xml.jar |
|
For JDK 5, set as follows: CLASSPATHJ=${ORACLE_HOME}/jdbc/lib/ojdbc5.jar:${ORACLE_HOME}/jlib/orai18n.jar The |
|
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} |
|
|
Table 3-3 describes the command-line utilities included in the Java XDK on UNIX. Before you can use these utilities, you must set up your environment.
Table 3-3 Java XDK 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 |
|
|
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 shown in Example 3-2 should generate version and usage information for the utilities.
Example 3-2 Testing the Java XDK 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 required for use with the Java XDK components.
Table 3-4 Windows Environment Settings for Java XDK Components
Variable | Notes |
---|---|
|
Includes the following (note that a single period "." to represent the current directory is not required but may be useful): .;%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 |
|
For JDK 5, set as follows: CLASSPATHJ=%ORACLE_HOME%\jdbc\lib\ojdbc5.jar:%ORACLE_HOME%\lib\orai18n.jar The |
|
Installation directory for the Java SDK, Standard Edition. Modify the path that links to the Java SDK. |
|
|
Table 3-5 describes the command-line utilities included in the Java XDK on Windows. Before you can use these utilities, you must set up your environment.
Table 3-5 Java XDK 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 |
|
|
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.
To obtain the version of XDK you are working with, use javac
to compile the Java code shown in Example 3-4.
Example 3-4 XDKVersion.java
// // 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 compiling the source file with javac
, run the program on the operating system command line as follows:
java XDKVersion You are using version: Oracle XML Developers Kit 11.1.0.6.0 - Production