diff options
author | Simon Pepping <spepping@apache.org> | 2007-01-06 14:18:57 +0000 |
---|---|---|
committer | Simon Pepping <spepping@apache.org> | 2007-01-06 14:18:57 +0000 |
commit | 77dc613c7a01946b183846bafb91e8a37bdebcdc (patch) | |
tree | 315e590aa1e24424106853569e1e309117a33820 /src | |
parent | 2198b4395c27f3ba3fa6688e316eb246c5c08e73 (diff) | |
download | xmlgraphics-fop-77dc613c7a01946b183846bafb91e8a37bdebcdc.tar.gz xmlgraphics-fop-77dc613c7a01946b183846bafb91e8a37bdebcdc.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/documentation/content/xdocs/trunk/running.xml | 57 | ||||
-rw-r--r-- | src/java/org/apache/fop/cli/Main.java | 8 |
2 files changed, 42 insertions, 23 deletions
diff --git a/src/documentation/content/xdocs/trunk/running.xml b/src/documentation/content/xdocs/trunk/running.xml index 4b488ef12..5ab36f4a2 100644 --- a/src/documentation/content/xdocs/trunk/running.xml +++ b/src/documentation/content/xdocs/trunk/running.xml @@ -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 <CLASSPATH> - org.apache.fop.cli.Main <arguments></code>. The arguments + org.apache.fop.cli.Main <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 <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 + <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> diff --git a/src/java/org/apache/fop/cli/Main.java b/src/java/org/apache/fop/cli/Main.java index cf793e2c0..e2297380d 100644 --- a/src/java/org/apache/fop/cli/Main.java +++ b/src/java/org/apache/fop/cli/Main.java @@ -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; |