Apache POI PPT - Installation


This chapter takes you through the process of setting up Apache POI on Windows and Linux based systems. Apache POI can easily be installed and integrated with your current Java environment, following a few simple steps without any complex setup procedures. User administration is required for installation.

System Requirements

JDK Java SE 2 JDK 1.5 or above
Memory 1 GB RAM (recommended)
Disk Space No minimum requirement
Operating System Version Windows XP or above, Linux

Let us now proceed with the steps to install Apache POI.

Step 1: Verify your Java Installation

First of all, you need to have Java Software Development Kit (SDK) installed on your system. To verify this, execute any of the following two commands depending on the platform you are working on.

If the Java installation has been done properly, then it will display the current version and specification of your Java installation. A sample output is given in the following table.

Platform Command Sample Output

Open Command Console and type −

\>java –version

Java version "1.7.0_60"

Java (TM) SE Run Time

Environment (build 1.7.0_60-b19)

Java Hotspot (TM) 64-bit Server

VM (build 24.60-b09,mixed mode)


Open Command terminal and type −

$java –version

java version "1.7.0_25"

Open JDK Runtime Environment (rhel-

Open JDK 64-Bit Server VM (build 23.7-b01, mixed mode)

Step 2: Set your Java Environment

Set the environment variable JAVA_HOME to point to the base directory location where Java is installed on your machine. For example,

Platform Description
Windows Set JAVA_HOME to C:\ProgramFiles\java\jdk1.7.0_60
Linux Export JAVA_HOME = /usr/local/java-current

Append the full path of Java compiler location to the System Path.

Platform Description
Windows Append the String "C:\Program Files\Java\jdk1.7.0_60\bin" to the end of the system variable PATH.
Linux Export PATH = $PATH:$JAVA_HOME/bin/

Execute the command java -version from the command prompt as explained above.

Step 3: Install Apache POI Library

Download the latest version of Apache POI from https://poi.apache.org/download.html and unzip its contents to a folder from where the required libraries can be linked to your Java program. Let us assume the files are collected in a folder on C drive.

The following images show the directories and the file structures inside the downloaded folder −

Jar Hierarchy1

Jar Hierarchy2

Add the complete path of the five jars as highlighted in the above image to the CLASSPATH.

Platform Description

Append the following strings to the end of the user variable CLASSPATH −














Following is the pom.xml file to run the programs in this tutorial.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">