Apache Software Foundation > Apache POI

- Home
- Help
- Component APIs
- Getting Involved

# Apache POI - How To Build

## JDK Version

POI 4.0 and later require JDK version 1.8 or later.

POI 3.11 and later 3.x versions require JDK version 1.6 or later.

POI 3.5 to 3.10 required the JDK version 1.5 or later. Versions prior to 3.5 required JDK 1.4+.

## Install Apache Ant

The POI build system requires Apache Ant version 1.8 - 1.9.x for Java 1.6 and higher. Newer versions (1.10.x) require Java 8 or higher.

The current source code has been tested to work with Ant version 1.9.x and 1.10.x.

Remember to set the ANT_HOME environment variable to where Ant was installed/extracted and add ANT_HOME/bin to your shell's PATH.

If you are unsure about the correct value for ANT_HOME, search your file system for "ant.jar". This file will be in the directory %ANT_HOME%/lib." For example, if the path to ant.jar is "C:/Programs/Ant/lib/ant.jar", then set ANT_HOME to "C:/Progams/Ant".

## Install Apache Forrest

The POI build system requires Apache Forrest to build the documentation.

Specifically the build has been tested to work with Forrest 0.90.

Remember to set the FORREST_HOME environment variable.

## Building Targets with Ant

The main targets of interest to our users are:

Ant Target | Description
--- | ---
clean | Erase all build work products (ie. everything in the build directory
compile | Compiles all files from main, ooxml and scratchpad
test | Run all unit tests from main, ooxml and scratchpad
jar | Produce jar files
assemble | Produce .zip and tar.gz distribution packages
docs | Generate all documentation (Requires Apache Forrest)
jenkins | Runs the tests which Jenkins, our Continuous Integration system, does. This includes the unit tests and various code quality checks.

## Working with Eclipse

Apache POI includes a pre-defined Eclipse project file which can be used to quickly get set up in the Eclipse IDE.

First make sure that Java is set up properly and that you can execute the 'javac' executable in your shell.

Next, open Eclipse and create either a local SVN repository, or a copy of the Git repository, and import the project into Eclipse.

Right-click on "build.xml", and select "Run As / Ant Build...". The "Edit Configuration" dialog should appear. In the "Targets" tab, select the "Compile" target and click on "Run".

Note: when executing junit tests from within Eclipse, you might need to set the system property "POI.testdata.path" to the actual location of the 'test-data' directory to make the test framework find the required test-files. A simple value of 'test-data' usually works.

## Working with IntelliJ Idea

We currently do not offer project files for IntelliJ and unfortunately it cannot import the project from the Ant build files.

In order to get started, first build Apache POI using Ant as described above to get all required 3rd party libraries downloaded.

Then import the main folder into a new project and then define all the source folders under src accordingly. Also add all libraries from the lib, compile-lib and ooxml-lib folders.

Note: when executing junit tests from within IntelliJ, you might need to set the system property "POI.testdata.path" to the actual location of the 'test-data' directory to make the test framework find the required test-files. A simple value of 'test-data' usually works.

## Using Maven

Building Apache POI using Maven is not currently officially supported, and we strongly suggest continuing to use the official Ant build.

However, including Apache POI within your own Maven project is fully supported, and widely used. Please see the Components Page for details of the Maven artifacts available.

## Setting environment variables

Linux: help.ubuntu.com, unix.stackexchange.com

Windows: en.wikipedia.org

by Glen Stampoultzis, Tetsuya Kitahata, David Fisher