JSON.simple - Environment Setup


Advertisements

Local Environment Setup

JSON.simple is a library for Java, so the very first requirement is to have JDK installed in your machine.

System Requirement

JDK Memory Disk Space Operating System
1.5 or above. No minimum requirement. No minimum requirement. No minimum requirement.

Step 1: Verify Java Installation in Your Machine

First of all, open the console and execute a java command based on the operating system you are working on.

OS Task Command
Windows Open Command Console c:\> java -version
Linux Open Command Terminal $ java -version
Mac Open Terminal machine:< joseph$ java -version

Let's verify the output for all the operating systems −

OS Output
Windows

java version "1.8.0_101"

Java(TM) SE Runtime Environment (build 1.8.0_101)

Linux

java version "1.8.0_101"

Java(TM) SE Runtime Environment (build 1.8.0_101)

Mac

java version "1.8.0_101"

Java(TM) SE Runtime Environment (build 1.8.0_101)

If you do not have Java installed on your system, then download the Java Software Development Kit (SDK) from the following link www.oracle.com. We are assuming Java 1.8.0_101 as the installed version for this tutorial.

Step 2: Set JAVA Environment

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

OS Output
Windows Set the environment variable JAVA_HOME to C:\Program Files\Java\jdk1.8.0_101
Linux export JAVA_HOME = /usr/local/java-current
Mac export JAVA_HOME = /Library/Java/Home

Append Java compiler location to the System Path.

OS Output
Windows Append the string C:\Program Files\Java\jdk1.8.0_101\bin at the end of the system variable, Path.
Linux export PATH = $PATH:$JAVA_HOME/bin/
Mac not required

Verify Java installation using the command java -version as explained above.

Step 3: Download JSON.simple Archive

Download the latest version of JSON.simple jar file from json-simple @ MVNRepository. At the time of writing this tutorial, we have downloaded json-simple-1.1.1.jar, and copied it into C:\>JSON folder.

OS Archive name
Windows json-simple-1.1.1.jar
Linux json-simple-1.1.1.jar
Mac json-simple-1.1.1.jar

Step 4: Set JSON_JAVA Environment

Set the JSON_JAVA environment variable to point to the base directory location where JSON.simple jar is stored on your machine. Let's assuming we've stored json-simple-1.1.1.jar in the JSON folder.

Sr.No OS & Description
1

Windows

Set the environment variable JSON_JAVA to C:\JSON

2

Linux

export JSON_JAVA = /usr/local/JSON

3

Mac

export JSON_JAVA = /Library/JSON

Step 5: Set CLASSPATH Variable

Set the CLASSPATH environment variable to point to the JSON.simple jar location.

Sr.No OS & Description
1

Windows

Set the environment variable CLASSPATH to %CLASSPATH%;%JSON_JAVA%\json-simple-1.1.1.jar;.;

2

Linux

export CLASSPATH = $CLASSPATH:$JSON_JAVA/json-simple-1.1.1.jar:.

3

Mac

export CLASSPATH = $CLASSPATH:$JSON_JAVA/json-simple-1.1.1.jar:.

Advertisements