Browse Source

Added fop.home to Main.getJARList. Adapted the documentation.


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@493473 13f79535-47bb-0310-9956-ffa450edef68
pull/25/head
Simon Pepping 17 years ago
parent
commit
a481f805fb

+ 35
- 22
src/documentation/content/xdocs/trunk/running.xml View File

@@ -184,7 +184,7 @@ Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl
<p>FOP's entry point for your own scripts is the class
<code>org.apache.fop.cli.Main</code>. The general pattern for the
command line is: <code>java -classpath &lt;CLASSPATH>
org.apache.fop.cli.Main &lt;arguments></code>. The arguments
org.apache.fop.cli.Main &lt;arguments></code>. The arguments
consist of the options and infile and outfile specifications
as shown above for the standard scripts. You may wish to review
the standard scripts to make sure that
@@ -195,35 +195,48 @@ Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl
<title>Running with java's <code>-jar</code> option</title>
<p>
As an alternative to the start scripts you can run <code>java
-jar build/fop.jar</code> from the FOP_HOME directory. In this
case FOP tries to build the classpath for running FOP
dynamically, see <a href="#dynamical-classpath">below</a>. If
you use hyphenation, you must put <code>fop-hyph.jar</code> in
the <code>lib</code> directory.
-jar path/to/build/fop.jar &lt;arguments></code>, relying on
FOP to build the classpath for running FOP dynamically, see <a
href="#dynamical-classpath">below</a>. If you use hyphenation,
you must put <code>fop-hyph.jar</code> in the <code>lib</code>
directory.
</p>
<p>You can also run <code>java -jar fop.jar</code> from any
other working directory. This only works if you put

<p>You can also run <code>java -jar path/to/fop.jar
&lt;arguments></code>, relying on the <code>Class-Path</code>
entry in the manifest file. This works if you put
<code>fop.jar</code> and all jar files from the <code>lib</code>
directory in a single directory. See the <code>Class-Path</code>
entry in the manifest file. If you use hyphenation, you
directory in a single directory. If you use hyphenation, you
must also put <code>fop-hyph.jar</code> in that directory.</p>

<p>In both cases the arguments consist of the options and
infile and outfile specifications as shown above for the
standard scripts.</p>
</section>
<section id="dynamical-classpath">
<title>FOP's dynamical classpath construction</title>

<p>If FOP is started without a proper classpath, it tries to
add its dependencies dynamically. FOP expects to find
<code>fop.jar</code> in the <code>build</code> directory,
which is either the current working directory or one of its
subdirectories. Then FOP adds all <code>jar</code> files in
the <code>lib</code> directory to the classpath. The
<code>lib</code> directory is a sibling directory of the
<code>build</code> directory, or, if that does not exist, the
parent directory of the <code>build</code> directory. If the
system property <code>fop.optional.lib</code> contains the
name of a directory, then all <code>jar</code> files in that
directory are also added to the classpath. See the methods
<code>getJARList</code> and <code>checkDependencies</code> in
add its dependencies dynamically. If the system property
<code>fop.home</code> contains the name of a directory, then
FOP uses that directory as the base directory for its
search. Otherwise the current working directory is the base
directory. If the base directory is called <code>build</code>,
then its parent directory becomes the base directory.</p>

<p>FOP expects to find <code>fop.jar</code> in the
<code>build</code> subdirectory of the base directory, and
adds it to the classpath. Subsequently FOP adds all
<code>jar</code> files in the lib directory to the
classpath. The lib directory is either the <code>lib</code>
subdirectory of the base directory, or, if that does not
exist, the base directory itself.</p>

<p>If the system property <code>fop.optional.lib</code>
contains the name of a directory, then all <code>jar</code>
files in that directory are also added to the classpath. See
the methods <code>getJARList</code> and
<code>checkDependencies</code> in
<code>org.apache.fop.cli.Main</code>.</p>

</section>

+ 7
- 1
src/java/org/apache/fop/cli/Main.java View File

@@ -42,7 +42,13 @@ public class Main {
* instances to URLs.
*/
public static URL[] getJARList() throws MalformedURLException {
File baseDir = new File(".").getAbsoluteFile().getParentFile();
String fopHome = System.getProperty("fop.home");
File baseDir;
if (fopHome != null) {
baseDir = new File(fopHome).getAbsoluteFile();
} else {
baseDir = new File(".").getAbsoluteFile().getParentFile();
}
File buildDir;
if ("build".equals(baseDir.getName())) {
buildDir = baseDir;

Loading…
Cancel
Save