Java 2 SDK installation

Linux Installation Instructions

In this procedure, you will install the Java 2 SDK onto your Linux machine. After that, you may either download and install the Java 2 SDK documentation bundle, or start using the newly installed Java 2 SDK!

The installation procedure is simple, and consists of the following steps:

1. Check the file download size
2. Change to the directory you want to install into
3. Extract the contents of the Java 2 SDK
4. Delete the original file you downloaded (Optional)
5. Update PATH environment variable (Optional)

You can get the latest java jdk from the below given link

=====
http://java.sun.com/javase/downloads/index.jsp
=====

1. Check the download file size

Depending on the format you selected, check that you have downloaded the full, uncorrupted software bundle:

jdk-1_2_2_007-linux-i386.tar.gz 21,809,132 bytes

2. Change to the directory you want to install into.

For example, if you want to install the software in the /usr/local/ directory, then execute:

% cd /usr/local

Unbundling the software in the next step automatically creates a directory called jdk1.2.2. Note that if you choose to install the Java 2 SDK into system-wide location such as /usr/local, you must first become root to gain the necessary permissions. If you do not have root access, simply install the Java 2 SDK into your home directory, or a subdirectory that you have permission to write to.

Note about the Java 2 SDK doc bundle – You can get the Java 2 SDK documentation bundle from the SDK download page. You should unbundle the Java 2 SDK software bundle and the SDK documentation bundle in the same directory. Unbundling them in the same directory ensures that HTML links between them will work properly. You can download and install the software bundle and the documentation bundle in either order.

3. Extract the contents of the Java 2 SDK

Depending on the format you downloaded, execute the following command(s) in a shell window to extract the contents of the Linux Java 2 SDK:

% tar xvzf jdk-1_2_2_007-linux-i386.tar.gz

Or, if you prefer, uncompress and untar the file using 2 separate steps:

1. % gunzip jdk-1_2_2_007-linux-i386.tar.gz
2. % tar xvf jdk-1_2_2_007-linux-i386.tar

Note about overwriting files – If you unpack the software or documentation in a directory that contains a subdirectory named jdk1.2.2, the new software will overwrite files of the same name in that jdk1.2.2 directory. Please be careful to rename the old directory if it contains files you would like to keep.

4. Delete the original file you downloaded (Optional)

If you want to recover disk space, delete the file (or files) you originally downloaded.

5. Update the PATH environment variable

You can run the Java 2 SDK just fine without setting the PATH variable, or you can optionally set it as a convenience.

Should I set the PATH variable?
Set the path variable if you want to be able to run the executables (javac, java, javadoc, etc.) from any directory without having to type the full path of the command. If you don’t set the PATH variable, you need to specify the full path to the executable every time you run it, such as:

% /usr/local/jdk1.2.2/bin/javac MyClass.java

Is the PATH already set?
To find out if the path is currently set for any java tools, execute:

% which java

This will print the path to the java tool, if it can find it. If the PATH is not set properly, you will get the error:

% java: Command not found

How do I set the PATH permanently?
To set the path permanently, set the path in your startup file.

For C shell (csh), edit the startup file (~/.cshrc):

set path=(/usr/local/jdk1.2.2/bin $path)

For ksh, bash or sh, edit the profile file (~/.profile):

PATH=/usr/local/jdk1.2.2/bin:$PATH

Then load the startup file and verify that the path is set by repeating the “which” command above:

For C shell (csh):

% source ~/.cshrc
% which java

For ksh, bash or sh:

$ . $HOME/.profile
$ which java

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: