Tika Command Line Interface
| The tika-app command line interface is still in flux for 4.x; options and behavior may change between 4.x releases. |
tika-app extracts text and metadata from files on the command line. The authoritative option
list is java -jar tika-app.jar --help; this page mirrors that output and adds usage context. If
the two disagree, --help wins — please file a ticket.
It runs in three modes:
-
Standard — parse a single file, URL, or stdin and write the result to stdout.
-
GUI —
--guilaunches a desktop window for drag-and-drop parsing. -
Tika Pipes — process many documents from a directory (or S3, GCS, Azure, JDBC, …) through the asynchronous Pipes pipeline. Activated by the flags listed under How Pipes mode is activated.
Installation
tika-app is distributed as a zip. The bare tika-app-<version>.jar is a thin launcher and fails
with NoClassDefFoundError on its own — the parsers and supporting modules (including the Tika
Pipes processor) live in the adjacent lib/ directory, with plugins/ beside it. The zip has no
top-level directory, so unzip it into one and run from inside:
unzip -d tika-app-<version> tika-app-<version>.zip
cd tika-app-<version>
java -jar tika-app-<version>.jar [option...] [file...]
The examples below use tika-app.jar as shorthand for the versioned jar in the unzipped
distribution.
With no file or URL argument (or with -), tika-app parses standard input. With no arguments at
all and nothing piped in, the GUI launches.
|
Long flags take the GNU double-dash form; short flags take one dash and are a single letter
( Writing a long name with a single dash is always an error —
|
Standard-mode Options
For Pipes-mode options see Tika Pipes Processing.
Help and Information
| Option | Description |
|---|---|
|
Print the usage message. |
|
Print debug-level messages. |
|
Print the Apache Tika version. |
|
Launch the graphical interface (drag-and-drop parsing). |
Configuration
| Option | Description |
|---|---|
|
TikaConfig file (JSON in Tika 4.x). Must appear before |
|
Convert a legacy 3.x XML config to 4.x JSON (parsers section only) and write it to stdout.
Redirect to save: |
Output Formatting
| Option | Description |
|---|---|
|
Output Markdown content (body). Default. |
|
Output plain text content (body). |
|
Output XHTML content. |
|
Output HTML content. |
|
Output plain text, main content only, via the boilerpipe handler. |
|
Output all text content. |
|
Output metadata only. |
|
Output metadata in JSON. |
|
Output metadata in XMP. |
|
Output metadata and content from all embedded files. Combine with |
|
For JSON, XML and XHTML output, add newlines and whitespace for readability. |
|
Use output encoding |
Detection, Language and Content
| Option | Description |
|---|---|
|
Detect the document type and print the media type. |
|
Detect and print only the language. |
|
Use document password |
|
Include a digest of the parsed bytes: |
|
Maximum embedded-document depth to descend. Unlimited by default. |
|
Maximum number of embedded documents to extract. Unlimited by default. |
Listing and Inspection
| Option | Description |
|---|---|
|
List the available document parsers. |
|
List parsers as |
|
List the available parsers and their supported media types. |
|
Same as |
|
List the available document detectors. |
|
List detectors as |
|
List the available metadata models and their supported keys. |
|
List all known media types and related information. |
|
Compare Tika’s known media types to the |
Fork Mode (process isolation)
Fork mode parses the document in a separate JVM, protecting the main process from parser crashes, OOM, and hangs.
| Option | Description |
|---|---|
|
Run parsing in a forked JVM process. |
|
Total per-file budget in milliseconds. Default |
|
Stall detector: maximum time with no progress before the fork is killed as hung, in milliseconds.
Default |
|
Comma-separated JVM args for the forked process, e.g.
|
|
Directory containing plugin zips for the forked process. |
--fork-timeout is a hard error; it names --task-timeout and --progress-timeout as its
replacements.
|
Examples
# Text, JSON metadata, Markdown
java -jar tika-app.jar --text document.pdf
java -jar tika-app.jar --json document.docx
java -jar tika-app.jar --md document.docx
# A custom configuration
java -jar tika-app.jar --config=tika-config.json document.pdf
# Reading from stdin: extract a remote document and search it
curl http://example.com/document.doc | java -jar tika-app.jar --text | grep -q keyword
Tika Pipes Processing
For many documents — a local directory, S3, GCS, Azure, JDBC, or any other Tika Pipes source —
run tika-app with input and output paths. Under the hood this is Tika Pipes, dispatched
asynchronously into forked JVMs for fault tolerance. Tika prints a one-line banner to stderr when
it switches into Pipes mode, so you can confirm which path is running.
java -jar tika-app.jar -i /path/to/input -o /path/to/output
That parses every file under the input directory and writes JSON metadata (RMETA format) to the output directory.
The throughput, memory, and isolation characteristics of this forked-JVM pipeline — and how to size it — are described in Performance and Isolation Trade-offs.
How Pipes mode is activated
tika-app enters Pipes mode when any of these hold:
-
Two positional arguments are given and the first is an existing directory (
tika-app.jar /in /out). -
The last two arguments are an existing directory followed by a directory or a path that does not yet exist — the same pair with other options in front of it.
-
A single
.jsonargument is given — it is read as a Tika Pipes config file. -
Any of
-i,--inputDir,-o,--outputDir,--fileList,-z,--extract,--extract-dir,-Z, or-a/--asyncis present.
Anything else — a single file, a URL, stdin, --gui — stays in standard single-document mode.
-z/--extract/--extract-dir route into Pipes mode even for a single file. That works:
the input path may be a file rather than a directory, and the attachments land next to the output
as usual.
|
Input and output
| Option | Description |
|---|---|
|
Input directory (a single file also works). The long form is |
|
Output directory. The long form is |
|
File list, one path per line, relative to |
|
Behavior when an output file already exists: |
Output formatting
| Option | Description |
|---|---|
|
Content handler type: |
|
Concatenate content from all embedded documents into a single content field. |
|
Output only the extracted content — no metadata, no JSON wrapper. Implies |
Execution
| Option | Description |
|---|---|
|
Number of parallel forked JVMs. Defaults to |
|
|
|
Total task timeout per input file. Sets |
|
Tika config file. The standard-mode |
|
Plugins directory. |
|
Force Pipes mode. Redundant when |
Unpacking attachments
-z and -Z differ only in depth: -z extracts direct attachments (depth 1), -Z recurses
through every level. Both accept a single file or a directory as input.
| Option | Description |
|---|---|
|
Extract direct attachments (depth 1). |
|
Extract all attachments recursively. |
|
Output directory for the extracted bytes; equivalent to |
|
Output format: |
|
Output mode: |
|
Include |
Examples
# Markdown content only -- .md files with no JSON wrapper and no metadata fields
java -jar tika-app.jar -i /path/to/input -o /path/to/output --handler m --content-only
# Text with all metadata, embedded content concatenated into one field
java -jar tika-app.jar -i /path/to/input -o /path/to/output --concatenate
# With a Tika config file (-c /path/to/tika-config.json is equivalent)
java -jar tika-app.jar -i /path/to/input -o /path/to/output --config=tika-config.json
# Recursively unpack attachments into the output directory
java -jar tika-app.jar -i /path/to/input -o /path/to/output -Z