Reading:  

Quick introduction to Apache POI


Setting up the environment

This chapter explains the process of environment setup in Apache POI on Linux and Windows. It can be easily integrated and installed with existing java environment below are the steps. This installation requires administration privileges.

Core requirements for Apache POI includes

  1. POI 3.11 and later requires the 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 require JDK 1.4+.

  2. Atleast 1Gb RAM

  3. Linux or Windows

We will cover POI 3.11 in this tutorial

Install Java SDK

The installation instructions for installing and verifying Java install can be found on Oracle website from the link below

http://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html

To verfiy if the installation is successful, you can run this command from your shell prompt

$ java –version

Ouput for the above command will result in something like this

C:\>java -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
C:\>

Setup environment variables JAVA_HOME and PATH

Point the environment variable JAVA_HOME to set to the base directory location where Java is installed on user machine

On Linux, do this

export JAVA_HOME=”path to jdk folder”
export PATH=$JAVA_HOME/bin:$PATH
 

On windows, do this

SET JAVA_HOME = c:/Program Files/Java (The path where your JDK is installed)

Then you can set the bin path by typing

SET PATH = %PATH%;%JAVA_HOME%\bin

We are just appending the existing set PATH's with JAVA_HOME/bin.
Once done run this command to verify that it worked

echo %PATH%

 

Installing Apache POI

First we will need to download the Apache POI from apache.org

Current version of Apache POI at the time of writing this tutorial is 3.11 and Apache POI 3.12 is in beta

Here are the essential JAR files that should be in your CLASSPATH 

Add above pointed files to the CLASSPATH. 

To check how to utilize PATH and CLASSPATH environment variables in Linux and Windows please visit 

http://docs.oracle.com/javase/tutorial/essential/environment/paths.html

and 

https://docs.oracle.com/javase/8/docs/technotes/tools/windows/classpath.html

Once done, you are all set.

 

Description

This tutorial covers Apache POI, This tutorial is divided into 12 parts as listed below

  • What is Apache POI
  • Environment
  • Core Classes
  • Workbooks
  • Spreadsheets
  • Cells
  • Fonts
  • Formula
  • Hyperlink and defiining Print Area
  • Database 

Let us know if we made any error, your feedback is important. 



Prerequisites

Its is important that you have working knowledge of Java Programming language

Audience

Beginners seeking a quick introduction to Apache POI

Learning Objectives

To get you started with Apache POI

Author: Subject Coach
Added on: 10th Mar 2015

You must be logged in as Student to ask a Question.

None just yet!