Download and Install Apache POI in Eclipse [LATEST]

In this article, you will see how can you download Apache POI and install it in Eclipse IDE. You will also see how to add Apache POI maven dependency into the pom.xml file to build a Maven application.

Apache POI (Poor Obfuscation Implementation) is an open-source Java API library for manipulating the various Microsoft files format such as Excel, PowerPoint, Word in Java. This article shows you the complete environment set up for the Apache POI-5.1.0 to build an application for manipulating the Microsoft Excel file (XLS and XLSX) format.

Supported Java Version for Apache POI

  • Apache POI 4.0 and later require JDK version 1.8 or later.
  • Apache POI 3.11 and later 3.x versions require JDK version 1.6 or later.
  • Apache POI 3.5 to 3.10 required the JDK version 1.5 or later.
  • Apache POI versions prior to 3.5 required JDK 1.4+.

In this article, we are going to use the Apache poi-5.1.0 version so it required JDK 1.8+

How to Install Apache POI in Eclipse?

There are two ways for installing Apache POI in Eclipse IDE, based on your project type:

  1. Maven Project
  2. Stand alone Java Project

1. Apache poi Maven Project

If you are going to create a maven project for poi, then you have to add the following poi maven dependency in the pom.xml file of your project. Please note here, the poi-5.1.0 is the core module of the Apache poi that will work only for the XLS file. If you want to work with XLSX as well then you have to add both (poi-5.1.0 and poi-ooxml-5.1.0) modules.

<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>5.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>5.1.0</version>
</dependency>

2. Apache poi standalone Java Project

If you are going to create a standalone java project for poi then you have to add the following jar files into the java classpath/build path:

  1. poi-5.1.0.jar
  2. poi-ooxml-5.1.0.jar
  3. poi-ooxml-lite-5.1.0.jar
  4. xml-apis-1.4.01.jar
  5. xmlbeans-5.0.2.jar
  6. curvesapi-1.06.jar
  7. SparseBitSet-1.2.jar
  8. commons-io-2.11.0.jar
  9. commons-codec-1.15.jar
  10. commons-collections4-4.4.jar
  11. commons-compress-1.21.jar
  12. commons-math3-3.6.1.jar
  13. log4j-api-2.14.1.jar

How to download Apache POI jars?

You can easily download all the above jars for Apache poi 5.1.0 in one place: Download Apache POI Jars

download apache poi-5.1.0

Steps to add poi jar files into java build path

In Eclipse, right-click on your Project > Properties > select Java Build Path > Libraries Tab > Add External JARs… then choose above mention jars after that click on Apply and Close button as you can see in the below image:

add poi jars into java classpath

How to create an Apache POI maven application?

You are going to see, how to build or create a sample poi maven application in Eclipse IDE and add the poi maven dependency:

Steps to create poi maven application

Step-1: Create a new maven project by clicking File Menu > New > Maven Project and simply clicking on the Next button as below image:

apache poi new maven project dialog

Step-2: Select the maven archetype: maven-archetype-quickstart and click on Next as below image:

apche poi maven archetype quickstart

Step-3: Provide Group Id: com.javacodepoint and Artifact Id: DemoApplication and click on the Finish button as below image:

apache poi creating maven project

Step-4: Now add the below maven dependency into the pom.xml file:

<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>5.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>5.1.0</version>
</dependency>

Once you add the above Apache POI maven dependency, you would see the poi jars get added to your project as you can see in the below image:

maven dependencies for poi-5.1.0

That’s all, now you are ready with the Apache POI 5.1.0 environment setup in Eclipse IDE.

Conclusion

In this article, you have seen download and install Apache POI for manipulating the Microsoft Excel file(XLS and XLSX) format. Here you have seen we have taken the Apache poi-5.1.0 version to demonstrate it.

If you want to read and write an Excel file, visit another article here: Apache POI – Read and Write Excel files in java.

Share with friends

Leave a Comment

Your email address will not be published.