Warning!
FMPP, as a bulk file processor, may generates high amount of output files, and overwrites all files with the same names as the names of output files without warning. It's a practical decision comes from the usage pattern of the tool. So be careful with where the output files go!
Pre-requirements
- Java must be installed on your machine (version 5 or later). Java is available for free, and on various platforms (Windows, OS X, "Linux", etc.), so FMPP works on many platforms. There are some variations, all is fine: OpenJDK (popular on Linux), Oracle Java SE JRE, Oracle Java SE JDK, etc.
- If you want to use FMPP as an Apache Ant task, you need Apache Ant 1.5.1 or later.
Extracting
Extract the downloaded archive file (fmpp_X.X.X.tar.gz or fmpp_X.X.X.zip) into the directory where you prefer to store FMPP. For Windows users it is typically C:\Program Files\fmpp or C:\fmpp, for UN*X users it is typically ~/opt/fmpp or /opt/fmpp or /usr/lib/fmpp (where fmpp is the extracted fmpp_X.X.X directory after renaming). From now on I will refer to this directory as <FMPP_HOME>.
Setup the command-line tool
On Windows
The steps are:
- Extract the downloaded archive file (
fmpp_0.9.16.tar.gzorfmpp_0.9.16.zip) intoC:\Program Files\fmpp(note that "Program Files" may be shown in a localized form, like "Programme"), or intoC:\fmpp, or wherever you prefer to. From now on I will refer to this directory as<FMPP_HOME> - For convenience (optional), add
<FMPP_HOME>/binto thePATHenvironment variable. (How? Google: set path windows) - Check if
fmpp.batisn't present inC:\Windows(or in another directory in thePATH) from an earlier installation. Delete it if it does. - Check if the
JAVA_HOMEenvironment variable is set correctly (should point to your Java installation directory, not itsbinsubdirectory), or else that the intended version of thejavaexecutable is in thePATH. Otherwise FMPP may won't find Java. - To check that everything works, open a command line window and issue:
fmpp --version
Note: Because of the limitations of .bat files, you may get error messages like "The input line is too long". To solve this, install FMPP in a more "shallow" directory, so that the path to the FMPP related files will be shorter.
On UN*X (Linux, FreeBSD, OS X, etc.)
The steps are:
- Extract the downloaded archive file (
fmpp_0.9.16.tar.gzorfmpp_0.9.16.zip) into the~/opt/fmppor/opt/fmppor/usr/lib/fmppdirectory (conventions vary by distribution), or wherever you prefer to. From now on I will refer to this directory as<FMPP_HOME>. - For convenience (optional), create a soft link somewhere in the
PATH, likesudo ln -s <FMPP_HOME>/bin/fmpp /usr/bin/fmpp. (Alternatively, you can copy that shell script directly into/usr/bin/, or into other standard directory, and it will still automatically find the<FMPP_HOME>as far as it's one of the above listed well known directories, or if you have set theFMPP_HOMEenvironment variable yourself.) - Issue
which fmppto see if it's not shadowed by an earlier installation elsewhere. - Check if the intended version of the
javaexecutable is in thePATH, or else that theJAVA_HOMEenvironment variable is set correctly (should point to your Java installation directory, not itsbinsubdirectory). - To check that everything works, issue this in the command line:
fmpp --version
Notes
- If the
FMPP_HOMEenvironment variable is set,<FMPP_HOME>\bin\fmpp.batand<FMPP_HOME>\bin\fmppwill use that directory as<FMPP_HOME>. - You can run FMPP without the provided shell scripts directly with the
javacommand, likejava -jar <FMPP_HOME>/lib/fmpp.jar. (You can also put all required jar-s and class directories into theCLASSPATHand then issuejava fmpp.tools.CommandLine.) Note though that you will lose console width detection with these approaches. - You can move the jars into the
libsubdirectory of Ant (if you want to use the Ant task anyway). If you do this, the command line tool need Ant be installed on a "standard" location (likeC:\Program Files\ant), orANT_HOMEmust be correctly set.
Setup the Ant task
If you want to use FMPP as Apache Ant task, copy the required jar files from <FMPP_HOME>/lib into the lib directory of your Ant installation, or ensure that the jars are in the CLASSPATH environment variable. Then, whenever you need the FMPP task in a project, add this line to your build.xml:
<taskdef name="fmpp" classname="fmpp.tools.AntTask"/>
And then you can use the <fmpp ...> task.
Installing optional parts and custom extensions
For the command-line tool, simply drop the jar file that contains the additional classes into the <FMPP_HOME>/lib directory (or, into the Apache Ant lib directory, if you only use FMPP as Ant task). For the Ant task, either ensure that the required jars are in the CLASSPATH, or drop the jars into the lib directory of your Ant installation.
Updating FreeMarker
You can replace the included Apache FreeMarker version with a later version. Download the latest backward compatible FreeMarker release, and overwrite <FMPP_HOME>/lib/freemarker.jar with the freemarker.jar of the FreeMarker release. (Of course, if you are using the FMPP Ant task, you may need to replace the freemarker.jar in the lib directory of the Ant installation too.)