Apache Commons IO - Environment Setup


Advertisements

In this chapter, we will learn about the local environment setup of Apache Commons IO and how to set up the path of Commons IO for Windows 2000/XP, Windows 95/98/ME etc. We will also understand about some popular java editors and how to download Commons IO archive.

Local Environment Setup

System Requirements

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

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 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
Windows

Open command console and type −

\>java -version

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)

Linux

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)

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,

Sr.No. Platform & Description
1

Windows

Set JAVA_HOME to C:\ProgramFiles\java\jdk11.0.11

2

Linux

Export JAVA_HOME = /usr/local/java-current

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

Sr.No. Platform & Description
1

Windows

Append the String "C:\Program Files\Java\jdk11.0.11\bin" to the end of the system variable PATH.

2

Linux

Export PATH = $PATH:$JAVA_HOME/bin/

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

Popular Java Editors

To write your Java programs, you need a text editor. There are many sophisticated integrated development environment (IDEs) available in the market. But for now, you can consider one of the following −

  • Notepad − On Windows machine you can use any simple text editor like Notepad (Recommended for this tutorial), TextPad.

  • Netbeans − It is a Java IDE that is open-source and free which can be downloaded from www.netbeans.org/index.html.

  • Eclipse − It is also a Java IDE developed by the eclipse open-source community and can be downloaded from www.eclipse.org.

Download Common IO Archive

Download the latest version of Apache Common IO jar file from commons-io-2.11.0-bin.zip. At the time of writing this tutorial, we have downloaded commons-io-2.11.0-bin.zip and copied it into C:\>Apache folder.

OS Archive name
Windows commons-io-2.11.0-bin.zip
Linux commons-io-2.11.0-bin.tar.gz
Mac commons-io-2.11.0-bin.tar.gz

Set Apache Common IO Environment

Set the APACHE_HOME environment variable to point to the base directory location where Apache jar is stored on your machine. Assuming, we've extracted commons-io-2.11.0-bin.zip in Apache folder on various Operating Systems as follows.

OS Output
Windows Set the environment variable APACHE_HOME to C:\Apache
Linux export APACHE_HOME=/usr/local/Apache
Mac export APACHE_HOME=/Library/Apache

Set CLASSPATH Variable

Set the CLASSPATH environment variable to point to the Common IO jar location. Assuming, you have stored commons-io-2.11.0-bin.zip in Apache folder on various Operating Systems as follows.

OS Output
Windows Set the environment variable CLASSPATH to %CLASSPATH%;%APACHE_HOME%\commons-io-2.11.0.jar;.
Linux export CLASSPATH=$CLASSPATH:$APACHE_HOME/commons-io-2.11.0.jar:.
Mac export CLASSPATH=$CLASSPATH:$APACHE_HOME/commons-io-2.11.0.jar:.
Advertisements