Building and Running FAQs

| Questions |
| Swing version? Recompling source files? Regenerating API documention? How do I use Visual Age? Running on the Mac? Visual Cafe exception error?
| Answers |
| Which version of Swing is required? |
| This release uses Swing 1.1 (JFC 1.1). Swing is only used by the sample programs and is not required by the parser itself.
| How do I recompile the source files? |
| To build Xerces-J you need the Java Development Kit (JDK) version 1.2 (or higher) installed on your machine. The actual build is performed by the Ant program which is written in Java and is a subproject of the Apache Jakarta project. The build also requires a few other tools but all of the tools you need (including Ant) are contained in the Xerces-J-tools.4.3.0.zip file, packaged separately. Go to the Xerces-J download page to download the tools package and then extract it in the same location as the source package. Once you have extracted both the source and tools packages in the same directory, you can invoke a build by either using the "build.bat" file for Windows platforms or the "build.sh" file for UNIX platforms. Before invoking either one of these scripts, though, be sure to set the JAVA_HOME environment variable to the installed location of your JDK. The script will invoke the Ant build program for you which displays the list of allowed build targets. To only compile the source files, type "build compile" (on Windows platforms) at the command line in the directory where you extracted Xerces-J; to build the Jar files, type "build jars"; and to build everything, including documentation, type "build all".
| How do I regenerate the API documentation? |
| To regenerate the API documentation, you need to set up your environment to build Xerces-J. Instead of typing "build all", you type "build javadocs".
| How do I import Xerces-J into Visual Age for Java |
| Why does VisualAge for Java 2.0 report problems when I import the Xerces-J parser? The current version of the Xerces-J parser uses Swing 1.1, while VisualAge for Java 2.0 comes with Swing 1.0.2. The free update for the Professional version of VisualAge for Java 2.0 installs Swing 1.0.3. The most important difference between Swing 1.0.2 - 1.0.3 and 1.1 is the Java package was changed from com.sun.java.swing.* to javax.swing.*. To fix the errors, you must download the Java Foundation Classes 1.1 with Swing 1.1 from Sun's Java home page and import the "swingall.jar" file into VisualAge for Java 2.0. The Swing 1.1 package can be found at the following URL: http://java.sun.com/products/jfc/index.html Refer to the VisualAge for Java 2.0 documentation for information about how to import a JAR file into the repository and add that code to your workspace. Are there any other tips for importing the Xerces-J parser into VisualAge for Java 2.0? The most useful tip applies to any updated code that you import into the VisualAge for Java 2.0 product. Before updating code, do the following: 1. version the old code 2. delete it from your workspace 3. import the new code Deleting code from your workspace does not actually delete the code permanently - the versioned code is moved to the repository where it can be retrieved later. Be aware, though, that removing code from your workspace will cause problems with all of the other classes that use that code. VisualAge for Java 2.0 will flag them as errors but this situation is temporary. When you import the new code, the errors found when deleting the old code will be fixed. If you are unsure as to how to perform any of these steps, refer to the VisualAge for Java 2.0 documentation.
| How do I get Xerces-J to run on the Mac under MRJ? |
| Prerequisites (available from http://developer.apple.com/java/): MRJ 2.1 (this is the most recent version of the JVM) MRJ SDK 2.1 (this is the most recent version of the Java developer tools) Instructions (other variations would work also): Download the .tar.gz file containing Xerces-J. Use Stuffit Expander(tm), Suntar, or some other Macintosh tool that supports the .tar.gz format to expand the downloaded file. JBindery, part of MRJ SDK 2.1, is used to create a double-clickable Java application with the necessary configuration information built in. It is analogous to writing a .bat or .sh script. To run the dom.DOMWriter example: Double click on JBindery to start it up. Click on the Classpath panel. Click on the "Add .zip File" button and add both the "xerces.jar" and "xercesSamples.jar" files. Click on the Command panel. Enter "dom.Writer" as the Class name. Enter "data/personal.xml" in the Optional parameters box. Click on Save Settings button, pick a name such as "Run `dom.Writer`" for the file, and be sure that "Save as Application" is selected (this is the default) and save the file. Quit JBindery. You can now double click on the file you created in step (f) to run the XJParse example.
| Why do I get an ArrayIndexOutOfBoundsException in the Symantec Visual Cafe debugger? |
| The Visual Cafe debugger is set to trap `ArrayIndexOutOfBoundsException` exceptions by default. Xerces-J sometimes uses `ArrayIndexOutOfBoundsException` internally to signal exceptional, but not erroneous conditions. In order to run Xerces-J inside Visual Cafe's debugger, you need to turn off the trapping of these exceptions. To do this: Select the "Options" item in the "Project" menu. Select the "Debugger" tab in the dialog which appears. Select "Exceptions" from the popup menu. Remove the check from the checkbox for `java.lang.ArrayIndexOutOfBoundsException`.