<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="using-xquery" page="querycompilation" subpage="compilercommandline"/>
      <!--
           Generated at 2010-10-29T18:20:48.427+01:00--><title>Saxonica: XSLT and XQuery Processing: Java Code Generation from the Command Line</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: Java Code Generation from the Command Line"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Java Code Generation from the Command Line</h1>
      <p>The compilation is normally run from the command line, using the command:</p>
      <p class="command">java com.saxonica.CompileQuery [options] filename...</p>
      <p>where <i>filename</i> is a list of XQuery source files to be compiled. It is also possible to
use wildcards, for example <code>*.xq</code> to compile all the queries in a directory.</p>
      <p>The options are as follows (note that these have not been converted to use the -key:value style
                  used in other Saxon commands):</p>
      <table>
         <tr>
            <td content="para">
               <p>Option</p>
            </td>
            <td content="para">
               <p>Meaning</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>-package package-name</p>
            </td>
            <td content="para">
               <p>Name of the Java package to use for the generated class(es). By
default, the class(es) will not be in any package.</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>-class class-name</p>
            </td>
            <td content="para">
               <p>The name of the class to be generated, excluding any
package name. Use only when compiling a single query. By
default, a class name is constructed from the last part of the input filename, using an algorithm that strips punctuation
and adds capitalization according to Java conventions.</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>-jdir directory</p>
            </td>
            <td content="para">
               <p>Directory to hold the generated Java source code. If the source code is 
generated in a package, then subdirectories will be created as necessary to represent the package structure.</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>-e</p>
            </td>
            <td content="para">
               <p>Explain: show the structure of the optimized query</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>-servlet</p>
            </td>
            <td content="para">
               <p>Generate the Java code in the form of a servlet</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>-superclass</p>
            </td>
            <td content="para">
               <p>Full name of the class to act as the superclass of the 
generated class. Only needed if you want to customize the behavior.
Typically a user-defined subclass of <code>com.saxonica.deploy.CompiledUserQuery</code> or
<code>com.saxonica.deploy.CompiledQueryServlet</code>.</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>-t</p>
            </td>
            <td content="para">
               <p>Display progress information</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>-sa</p>
            </td>
            <td content="para">
               <p>Query is schema-aware</p>
            </td>
         </tr>
         <tr>
            <td content="para">
               <p>-untyped</p>
            </td>
            <td content="para">
               <p>Convert parameters to their required type. If set, this option causes the generated code to accept
                untypedAtomic values for external variables, and convert them to their declared type. This option is especially useful
                if the generated query is to be run from the command line, as all parameters supplied on the command line are
                treated as untypedAtomic values.</p>
            </td>
         </tr>
      </table>
      <p>The Java code is generated in the requested file, and it must then be compiled using the Java compiler
in the normal way. The classes referenced by the generated code are all in <code>saxon9sa.jar</code>,
which must be on the compiler classpath.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="runningcompiledfromcommandline.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>