Java Interface

This interface allows Antenna House Formatter V7.4 to be invoked from Java programs. See Java VM Issues.

The Java Interface uses JNI (Java Native Interface).

Library Files

The following library files are included in [Install directory] or [Install directory]/​lib.

Library fileContentsLocation
XfoJavaCtl.jarJava Archive[Install directory]/​lib
XfoJavaCtl74.dllJava Interface Library for Windows[Install directory]
libXfoJavaCtl74.soJava Interface Library for Linux[Install directory]/​lib
libXfoJavaCtl74.jnilibJava Interface Library for Macintosh[Install directory]/​lib

In order to execute the Java Interface, directory of execute java and [Install directory]/​lib/​XfoJavaCtl.jar must be included in the CLASSPATH environment variable. In addition, from using JNI (Java Native Interface), in Windows versions, [Install directory] must be included in the PATH environment variable. In the following environment, [Install directory]/​lib must be included. In Linux versions, it must be included in the LD_LIBRARY_PATH environment variable. In Macintosh version (64-bit version), it must be included in the java.library.path . See also Environment Variables for the necessary environment variables.

Windows versions:

> set CLASSPATH=[Install directory]/lib/XfoJavaCtl.jar;%CLASSPATH%
> set PATH=[Install directory];%PATH%

Linux versions:

$ CLASSPATH=[Install directory]/lib/XfoJavaCtl.jar:${CLASSPATH}
$ export CLASSPATH
$ LD_LIBRARY_PATH=[Install directory]/lib:${LD_LIBRARY_PATH}
$ export LD_LIBRARY_PATH

Java VM Issues

Antenna House Formatter V7.4 Java Interface is built with J2SE5.0 in Windows versions, Java SE 8 in Linux version (64-bit version), OpenJDK 8 in Amazon Linux 2 Graviton2 version, Java SE 6 in Macintosh version (64-bit version).

Use in an Application Server

Since the native JNI library can be read by two or more Java VM class loaders, when using this interface in application servers, such as Tomcat, do not install the XfoJavaCtl.jar in the WEB-INF/lib of the Web application. Set the interface to be read by class loaders (system class loader etc.) which only load once.

Use with Maven

To use the Antenna House Formatter V7.4 Java Interface jar in a Maven project, include the jar as a local dependency by setting its dependency scope to system and specifying systemPath.

<dependency>
  <groupId>jp.co.antenna</groupId>
  <artifactId>XfoJavaCtl</artifactId>
  <version>7.4</version>
  <scope>system</scope>
  <systemPath>[Install directory]/lib/XfoJavaCtl.jar</systemPath>
</dependency>

Alternatively, install the jar locally using Maven’s install plugin.

mvn install:install-file -Dfile=[Install directory]/lib/XfoJavaCtl.jar -DgroupId=jp.co.antenna -DartifactId=XfoJavaCtl -Dversion=7.4 -Dpackaging=jar

Another alternative is to create your own repository and deploy the jar there.

Running the Sample Program

You can download simple sample programs from our website.

The following shows how to execute these sample programs. In this case the path to unzipped java directory must be included in CLASSPATH.

The current directory of the following samples is the directory containing the java directory where the sample is unzipped.

> cd java
> javac sample.java
> java sample sample.fo sample.pdf

In Macintosh version (64-bit version), the setting of java.library.path needs to be added in the java command as follows:

> java -Djava.library.path="[Install directory]/lib" sample sample.fo sample.pdf

API Specification