13 September 2009

0 Basic JAVA Tutorial - JAVA Installation and Set Up Guide

Basic JAVA Tutorial - CHAPTER-8 installation and Set Up of JAVA

Installing and using JAVA

Before we begin JAVA installation, some points on JAVA installation

• For executing Java Programs Java 2 SDK Version 1.4 or higher Version needs to be installed.
• Java 2 SDK Can be downloaded freely from http://java.sun.com
• IDEs for JAVA are Eclipse and Netbeans, and Eclipse can be downloaded freely and doesnot require installation

Setting Environment variables for Java
We need to set some Environmental variables.
• Environmental variable is a variable that describes the operating environment of the process
• Common environment variables describe the home directory, command search path etc.

Environment variables used by JVM

JAVA_HOME
This environment variable is pointing to the Java Installation directory. This environment variable is used to derive all other environment variables used by JVM

In Windows:
set JAVA_HOME=C:\ProgramFiles\JAVA\jdk1.4.3

In UNIX:
export JAVA_HOME=/var/usr/java

CLASSPATH

Path variable is used by OS to locate executable files
In Windows:
set PATH=%PATH%;%JAVA_HOME%\lib\tools.jar

In UNIX:
set PATH=$PATH:$JAVA_HOME/lib/tools.jar:.

Do the Environmental variable settings by typing the given commands in the Command Prompt and Type ‘javac’. It will display all the options of using javac as shown in the diagram. If it says bad command or file name then check the path setting.

Alternate way to set CLASSPATH
In Windows:
set PATH=%PATH%;%JAVA_HOME%\bin

In UNIX:
set PATH=$PATH:$JAVA_HOME/bin
• This approach helps in managing multiple versions of Java – Changing JAVA_HOME will reflect on CLASSPATH and PATH as well


0 comments:

Feeds Comments

Please give your valuable comments.