Skip to content

Using Reach from a FAT JAR

Tom Hicks edited this page Nov 21, 2017 · 26 revisions

Creating a FAT JAR

Reach can be compiled, along with all its required dependencies, into a single JVM JAR file, known as a 'FAT' JAR. To produce a default FAT JAR for Reach:

sbt assembly

The resulting FAT JAR will be located in the target/scala-2.11 subdirectory and will be named with the current project version number and the suffix '-FAT.jar' (e.g., reach-1.4.0-FAT.jar)

The default Reach FAT JAR runs a main program to do 'batch' mode processing: reading papers from an input directory and producing result files into an output directory. This is equivalent to running the main program org.clulab.reach.RunReachCLI using sbt. A FAT JAR may also be produced which runs a different main program. For instance, to produce a FAT JAR which runs the interactive Reach Shell, compile it like this:

sbt -DmainClass=org.clulab.reach.ReachShell assembly

As mentioned, compiling a FAT JAR with no mainClass specification, produces a FAT JAR which will run the batch mode program. Such a FAT JAR file could (redundantly) be created like this:

sbt -DmainClass=org.clulab.reach.RunReachCLI assembly

As an alternative to batch mode, it is possible to create a FAT JAR which runs a small web service to process files. To use the web service, compile the FAT JAR like this:

sbt -DmainClass=org.clulab.reach.export.server.FileProcessorWebUI assembly

Running the FAT JAR

To run the Reach FAT JAR, simply call it from using the Java runtime system:

java -jar reach-1.4.0-FAT.jar

Additional runtime arguments to the embedded main program may be provided on the command line after the JAR name. For example, when starting a FAT JAR previously compiled to run the file processing server, you may specify a port for the server to use as follows:

java -jar reach-1.4.0-FAT.jar --port 8088

Reach Configuration

Input and output directories, and many other configuration options, may be specified in the application.conf configuration file. For more information on running Reach see the Running Reach Wiki page.