UnixServerAdmin

Server Administration & Management

How to Install Java on Linux

1. Download jdk-6u27-linux-i586.bin from Orcale website and copy /root directory

2. Install jdk-6u27-linux-i586.bin file in linux

# ./jdk-6u27-linux-i586.bin

3. Copy jdk abtract folder to /usr/local directory

# cp -rvdf /root/jdk1.6.0_27 /usr/local

4. Install and Remove Java

# yum install java

======================================================================
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.7.b09.el5 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved
======================================================================
 Package                                   Arch                          Version                                      Repository                        Size
======================================================================
Installing:
 java-1.6.0-openjdk              x86_64                     1:1.6.0.0-1.7.b09.el5           base.repo                         27 M
Transaction Summary
=======================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 27 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing     : java-1.6.0-openjdk                                                                                                                    1/1

Installed:
java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.7.b09.el5

Complete!
=====================================================================

# yum remove java

=====================================================================
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Remove Process
Resolving Dependencies
–> Running transaction check
—> Package java-1.4.2-gcj-compat.x86_64 0:1.4.2.0-40jpp.115 set to be erased
–> Processing Dependency: java-gcj-compat >= 1.0.64 for package: gjdoc
–> Processing Dependency: java-gcj-compat >= 1.0.64 for package: gjdoc
–> Processing Dependency: java-gcj-compat for package: antlr
–> Processing Dependency: java-gcj-compat for package: antlr
—> Package java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.7.b09.el5 set to be erased
–> Running transaction check
—> Package antlr.x86_64 0:2.7.6-4jpp.2 set to be erased
—> Package gjdoc.x86_64 0:0.7.7-12.el5 set to be erased
–> Finished Dependency Resolution

Dependencies Resolved

=====================================================================
 Package                                     Arch                         Version                                      Repository                       Size
=====================================================================
Removing:
 java-1.4.2-gcj-compat           x86_64                    1.4.2.0-40jpp.115                    installed                           441
 java-1.6.0-openjdk                 x86_64                    1:1.6.0.0-1.7.b09.el5              installed                           73 M
Removing for dependencies:
 antlr                                           x86_64                     2.7.6-4jpp.2                             installed                           3.2 M
 gjdoc                                         x86_64                     0.7.7-12.el5                              installed                           2.2 M
Transaction Summary
=====================================================================
Remove        4 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing        : java-1.4.2-gcj-compat                                                                                                 1/4
Erasing        : antlr                                                                                                                                 2/4
Erasing        : java-1.6.0-openjdk                                                                                                      3/4
Erasing        : gjdoc                                                                                                                               4/4

Removed:
 java-1.4.2-gcj-compat.x86_64 0:1.4.2.0-40jpp.115                              java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.7.b09.el5

Dependency Removed:
antlr.x86_64 0:2.7.6-4jpp.2                                                   gjdoc.x86_64 0:0.7.7-12.el5

Complete!
======================================================================

5. Make soft link for bin and java

# ln -s /usr/local/jdk1.6.0_27/bin /usr/bin

# ln -s /usr/local/jdk1.6.0_27/bin/java /usr/bin/java

6. Check whether java is working by the command

# java -version
======================================================================
java version “1.6.0_27”
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
======================================================================

7. Now Java is working successful.

Advertisements

September 17, 2011 - Posted by | Java, Tips & Tricks, Tomcat, Unix/Linux | , , , ,

No comments 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: