Tuesday, January 17, 2017

Jackson - Environment Setup

This chapter describes how to set up the Jackson environment on your system.

Try-It Online Option

You really do not need to set up your own environment to start learning Jackson. We have set up an online Java Programming environment online, so that you can compile and execute all the available examples online. Feel free to modify any example and check the result with different options.
Try the following example using the Try it option available at the top right corner of the sample code box on our website −
 
public class MyFirstJavaProgram {
   public static void main(String []args) {
      System.out.println("Hello World");
   }
}
For most of the examples given in this tutorial, you will find a Try it option to help you learn quickly through practice.

Local Environment Setup

If you still wish to set up your environment for Java programming language, then this section guides you on how to download and set up Java on your machine. Follow the given steps to set up the environment.
Java SE is freely available from the link Download Java. You can download a version based on your operating system.
Follow the instructions to download Java and run the .exe to install Java on your machine. Once you have installed Java, you would need to set the environment variables to point to the correct installation directories.

Setting up the Path for Windows 2000/XP

Assuming you have installed Java in c:\Program Files\java\jdk directory,
  • Right-click on 'My Computer'.
  • Select 'Properties'.
  • Click on the 'Environment variables' button under the 'Advanced' tab.
  • Alter the 'Path' variable so that it also contains the path to the Java executable. For example, if the path is currently set to 'C:\WINDOWS\SYSTEM32', then change your path to read 'C:\WINDOWS\SYSTEM32;c:\Program Files\java\jdk\bin'.

Setting up the Path for Windows 95/98/ME

Assuming you have installed Java in c:\Program Files\java\jdk directory,
  • Edit the 'C:\autoexec.bat' file
  • Add the following line at the end −
    'SET PATH=%PATH%;C:\Program Files\java\jdk\bin'

Setting up the Path for Linux, UNIX, Solaris, and FreeBSD

Environment variable PATH should be set to point to where the Java binaries have been installed. Refer to your shell documentation if you have trouble doing this.
For example, if you use bash as your shell, then you need to add the following line at the end of your '.bashrc: export PATH=/path/to/java:$PATH'.

Popular Java Editors

To write Java programs, you need a text editor. There are sophisticated IDEs available in the market to write Java programs, but for now, you can consider one of the following −
  • Notepad − On Windows platform, you can use any simple text editor such as Notepad (recommended for this tutorial) or TextPad.
  • Netbeans − It is an open-source Java IDE. It can be downloaded from http://www.netbeans.org/index.html.
  • Eclipse − It is also a Java IDE developed by the Eclipse open-source community. It can be downloaded from http://www.eclipse.org/.

Download Jackson Archive

Download the latest version of Jackson jar file from jackson-all-1.9.0.jar.zip. In this tutorial, jackson-1.9.0.jar is downloaded and copied into C:\>jackson folder.
OS Archive name
Windows jackson-all-1.9.0.jar
Linux jackson-all-1.9.0.jar
Mac jackson-all-1.9.0.jar

Set up Jackson Environment

Set the jackson_HOME environment variable to point to the base directory location where Jackson jar is stored on your machine. Depending on the platform you are working on, the process varies as shown in the following table −
OS Output
Windows Set the environment variable jackson_HOME to C:\jackson
Linux export jackson_HOME=/usr/local/jackson
Mac export jackson_HOME=/Library/jackson

Set CLASSPATH Variable

Set the CLASSPATH environment variable to point to the Jackson jar location.
OS Output
Windows Set the environment variable CLASSPATH to %CLASSPATH%;%jackson_HOME%\jackson-all-1.9.0.jar;.;
Linux export CLASSPATH=$CLASSPATH:$jackson_HOME/jackson-all- 1.9.0.jar:.
Mac export CLASSPATH=$CLASSPATH:$jackson_HOME/jackson-all- 1.9.0.jar:.

No comments:

Post a Comment