Install JDK 6 and tomcat 7 in RedHat5.2. Prerequisites:
RedHat 5.2 install jdk 6 and tomcat 7
Software preparation:
[Red Hat Enterprise. Linux.5]. TLF-SOFT-RedHat.Enterprise.Linux.5.Update.2-XiSO.iso
Jdk-6u22-linux-i586-rpm.bin
Apache-tomcat-7.0.4.tar.gz or apache-tomcat-7.0.4-src.tar.gz
Check Before installing JDK. JDK is installed by default in redhat5 Enterprise Edition and needs to be uninstalled.
[Root @ mongorv ~] # Java -- version
Java version "1.4.2"
Gij (GNU libgcj) version 4.1.2 20071124 (Red Hat 4.1.2-42)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
Warranty; not even for MERCHANTABILITY or fitness for a particle PURPOSE.
[Root @ mongorv ~] # Yum remove java
Loading "security" plugin
Loading "rhnplugin" plugin
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.i386. 4.2.0-40jpp. 115 set to be erased
--> Processing Dependency: java-gcj-compat for package: anlr
--> Processing Dependency: java-gcj-compat for package: anlr
--> Processing Dependency: java-gcj-compat >=1.0.64 for package: gjdoc
--> Processing Dependency: java-gcj-compat >=1.0.64 for package: gjdoc
--> Running transaction check
---> Package anlr. i386. 7.6-4jpp. 2 set to be erased
---> Package gjdoc. i386. 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 i386 1.4.2.0-40jpp. 115 installed 441
Removing for dependencies:
Anlr i386 2.7.6-4jpp. 2 installed 2.5 M
Gjdoc i386 0.7.7-12. el5 installed 1.7 M
Transaction Summary
========================================================== ============================================
Install 0 Package (s)
Update 0 Package (s)
Remove 3 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: anlr ######################### [1/3]
Erasing: gjdoc ######################### [2/3]
Erasing: java-1.4.2-gcj-compat ######################## [3/3]
Removed: java-1.4.2-gcj-compat.i386. 4.2.0-40jpp. 115
Dependency Removed: anlr. i386 2. 7.6-4jpp. 2 gjdoc. i386. 7.7-12. el5
Complete!
[Root @ mongorv ~] #
Install the JDK environment. JDK6.0 is java 1.6.0.
[Root @ mongorv ~] # Cd/usr/local/src
[Root @ mongorv src] # chmod 755 jdk-6u22-linux-i586-rpm.bin
[Root @ javasrv src] #./jdk-6u22-linux-i586-rpm.bin // directory generated after installation/usr/java
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu ).
Inflating: jdk-6u22-linux-i586.rpm
Inflating: sun-javadb-common-10.5.3-0.2.i386.rpm
Inflating: sun-javadb-core-10.5.3-0.2.i386.rpm
Inflating: sun-javadb-client-10.5.3-0.2.i386.rpm
Inflating: sun-javadb-demo-10.5.3-0.2.i386.rpm
Inflating: sun-javadb-docs-10.5.3-0.2.i386.rpm
Inflating: sun-javadb-javadoc-10.5.3-0.2.i386.rpm
Preparing... ######################################## ### [100%]
1: jdk ####################################### #### [100%]
Unpacking JAR files...
Rt. jar...
Jsse. jar...
Charsets. jar...
Tools. jar...
Localedata. jar...
Plugin. jar...
Javaws. jar...
Deploy. jar...
Installing JavaDB
Preparing... ######################################## ### [100%]
1: sun-javadb-common ################################### ####### [1, 17%]
2: sun-javadb-core ################################### ####### [1, 33%]
3: sun-javadb-client ################################### ####### [1, 50%]
4: sun-javadb-demo ################################### ####### [1, 67%]
5: sun-javadb-docs ################################### ####### [1, 83%]
6: sun-javadb-javadoc ################################### ####### [1, 100%]
Java (TM) SE Development Kit 6 successfully installed.
Product Registration is FREE and has des has benefits:
* Notification of new versions, patches, and updates
* Special offers on Sun products, services and training
* Access to early releases and documentation
Product and system data will be collected. If your configuration
Supports a browser, the Sun Product Registration form
The JDK will be presented. If you do not register, none
This information will be saved. You may also register your
JDK later by opening the register.html file (located in
The JDK installation directory) in a browser.
For more information on what data Registration collects and
How it is managed and used, see:
Http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html
Press Enter to continue .....
Done.
[Root @ mongorv src] # ll/usr/java
Total 4
Lrwxrwxrwx 1 root 16 Jul 3 19: 26 default->/usr/java/latest
Drwxr-xr-x 9 root 4096 Jul 3 19: 26 jdk1.6.0 _ 22
Lrwxrwxrwx 1 root 21 Jul 3 19: 26 latest->/usr/java/jdk1.6.0 _ 22
Configure Environment Variables
Modify the/etc/profile file (effective at the system level)
[Root @ mongorv src] # vi/etc/profile
JAVA_HOME =/usr/java/default
PATH = $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin: $ PATH
CLASSPATH =.: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib: $ CLASSPATH
Export path user logname mail hostname histsize inputrc JAVA_HOME CLASSPATH
[Root @ mongorv src] # source/etc/profile
[Root @ mongorv src] # java-version
Java version "1.6.0 _ 22"
Java (TM) SE Runtime Environment (build 1.6.0 _ 22-b04)
Java HotSpot (TM) Client VM (build 17.1-b03, mixed mode, sharing)
Modify the. bashrc file (valid for the current user)
[Root @ mongorv src] # vi ~ /. Bashrc
JAVA_HOME =/usr/java/default
PATH = $ JAVA_HOME/bin: $ JAVA_HOME/jre/bin: $ PATH
CLASSPATH =.: $ JAVA_HOME/lib: $ JAVA_HOME/jre/lib: $ CLASSPATH
Export path user logname mail hostname histsize inputrc JAVA_HOME CLASSPATH
Verify the java environment
[Root @ mongorv src] # more HelloWorld. java
/* HelloWorld. java */
Public class HelloWorld {
Public static void main (String arg []) {
System. out. println ("Hello, World! ");
}
}
[Root @ mongorv src] # javac HelloWorld. java
Compiled "HelloWorld. class"
[Root @ javasrv src] # java HelloWorld // No extension
Hello, World!
Command executed successfully