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 be easily installed and integrated with your current Java environment following a few simple steps without any complex setup procedures. User administration is required while installation.
Let us now proceed with the steps to install Apache POI.
First of all, you need to have Java Software Development Kit (SDK) installed on your system. To verify this, execute any of the 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.
java version "11.0.11" 2021-04-20 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.11+9-LTS-194)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.11+9-LTS-194, mixed mode)
Open command console and type −
\>java –version
java version "11.0.11" 2021-04-20 LTS
Open JDK Runtime Environment 18.9 (build 11.0.11+9-LTS-194)
Open JDK 64-Bit Server VM (build 11.0.11+9-LTS-194, mixed mode)
Open command terminal and type −
$java –version
java version "11.0.11" 2021-04-20 LTS
Open JDK Runtime Environment 18.9 (build 11.0.11+9-LTS-194)
Open JDK 64-Bit Server VM (build 11.0.11+9-LTS-194, mixed mode)
We assume the readers of this tutorial have Java SDK version 11.0.11 installed on their system.
We assume the readers of this tutorial have Java SDK version 11.0.11 installed on their system.
In case you do not have Java SDK, download its current version from www.oracle.com/technetwork/java/javase/downloads/index.html and have it installed.

In case you do not have Java SDK, download its current version from www.oracle.com/technetwork/java/javase/downloads/index.html and have it installed.
Set the environment variable JAVA_HOME to point to the base directory location where Java is installed on your machine. For example,
Windows
Set JAVA_HOME to C:\ProgramFiles\java\jdk11.0.11
Linux
Export JAVA_HOME = /usr/local/java-current
Append the full path of Java compiler location to the System Path.
Windows
Append the String "C:\Program Files\Java\jdk11.0.11\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.
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.
Add the complete path of the required jars as shown below to the CLASSPATH.
Windows
Append the following strings to the end of the user variable
CLASSPATH −
C:\poi-bin-5.1.0\poi-5.1.0.jar;
C:\poi-bin-5.1.0\poi-ooxml-5.1.0.jar;
C:\poi-bin-5.1.0\poi-ooxml-full-5.1.0.jar;
C:\poi-bin-5.1.0\lib\commons-codec-1.15.jar;
C:\poi-bin-5.1.0\lib\commons-collections4-4.4.jar;
C:\poi-bin-5.1.0\lib\commons-io-2.11.0.jar;
C:\poi-bin-5.1.0\lib\commons-math3-3.6.1.jar;
C:\poi-bin-5.1.0\lib\log4j-api-2.14.1.jar;
C:\poi-bin-5.1.0\lib\SparseBitSet-1.2.jar;
C\poi-bin-5.1.0\ooxml-lib\commons-compress-1.21.jar
C\poi-bin-5.1.0\ooxml-lib\commons-logging-1.2.jar
C\poi-bin-5.1.0\ooxml-lib\curvesapi-1.06.jar
C\poi-bin-5.1.0\ooxml-lib\slf4j-api-1.7.32.jar
C\poi-bin-5.1.0\ooxml-lib\xmlbeans-5.0.2.jar
Linux
Export CLASSPATH = $CLASSPATH:
/usr/share/poi-bin-5.1.0/poi-5.1.0.jar.tar:
/usr/share/poi-bin-5.1.0/poi-ooxml-5.1.0.tar:
/usr/share/poi-bin-5.1.0/poi-ooxml-full-5.1.0.tar:
/usr/share/poi-bin-5.1.0/lib/commons-codec-1.15.jar.tar:
/usr/share/poi-bin-5.1.0/lib/commons-collections4-4.4.tar:
/usr/share/poi-bin-5.1.0/lib/commons-io-2.11.0.tar:
/usr/share/poi-bin-5.1.0/lib/commons-math3-3.6.1.tar:
/usr/share/poi-bin-5.1.0/lib/log4j-api-2.14.1.tar:
/usr/share/poi-bin-5.1.0/lib/SparseBitSet-1.2.tar:
/usr/share/poi-bin-5.1.0/ooxml-lib/commons-compress-1.21.tar:
/usr/share/poi-bin-5.1.0/ooxml-lib/commons-logging-1.2.tar:
/usr/share/poi-bin-5.1.0/ooxml-lib/curvesapi-1.06.tar:
/usr/share/poi-bin-5.1.0/ooxml-lib/slf4j-api-1.7.32.tar:
/usr/share/poi-bin-5.1.0/ooxml-lib/xmlbeans-5.0.2.tar:
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">
   <modelVersion>4.0.0</modelVersion>
   <groupId>ApachePoiPPT</groupId>
   <artifactId>ApachePoiPPT</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <build>
      <sourceDirectory>src</sourceDirectory>
      <plugins>
         <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
               <source>11</source>
               <target>11</target>
               <compilerArgs>
                  <arg>--add-modules</arg>
                  <arg>java.se,java.desktop</arg>
               </compilerArgs>
            </configuration>
         </plugin>
      </plugins>
   </build>
   <dependencies>  
      <dependency>
         <groupId>org.apache.poi</groupId>
         <artifactId>poi</artifactId>
         <version>5.1.0</version>
      </dependency>
      <dependency>
         <groupId>org.apache.poi</groupId>
         <artifactId>poi-ooxml</artifactId>
         <version>5.1.0</version>
      </dependency>    
   </dependencies>
</project>

    46 Lectures 
     3.5 hours 

 Arnab Chakraborty

    23 Lectures 
     1.5 hours 

 Mukund Kumar Mishra

    16 Lectures 
     1 hours 

 Nilay Mehta

    52 Lectures 
     1.5 hours 

 Bigdata Engineer

    14 Lectures 
     1 hours 

 Bigdata Engineer

    23 Lectures 
     1 hours 

 Bigdata Engineer
 Print
 Add Notes
 Bookmark this page