Download the JDK from http://java.sun.com/j2se/1.5.0/download.jsp
(A) install jdk by running the RPM or bin file.
Installation Instructions
Install formats - JDK 5.0 is available in two installation formats.
- Self-extracting Binary File - This file can be used to install the JDK in a location chosen by the user. This one can be installed by anyone (not only root users), and it can easily be installed in any location. As long as you are not root user, it cannot displace the system version of the Java platform suppled by Linux. To use this file, see Installation of Self-Extracting Binary below.
- RPM Packages - A rpm.bin file containing RPM packages, installed with the rpm utility. Requires root access to install, and installs by default in a location that replaces the system version of the Java platform supplied by Linux. To use this bundle, see Installation of RPM File below.
Choose the install format that is most suitable to your needs.
Note: For any text on this page containing the following notation, you must substitute the appropriate JDK update version number for the notation.
For example, if you are downloading update 1.5.0_01, the following command:
]# ./jdk-1_5_0_
would become:
]# ./jdk-1_5_0_01-linux-i586.bin
Installation of Self-Extracting Binary
Use these instructions if you want to use the self-extracting binary file to install the JDK.
1. Download and check the download file size to ensure that you have downloaded the full, uncorrupted software bundle.You can download to any directory you choose; it does not have to be the directory where you want to install the JDK.
Before you download the file, notice its byte size provided on the download page on the web site. Once the download has completed, compare that file size to the size of the downloaded file to make sure they are equal.
2. Make sure that execute permissions are set on the self-extracting binary.
Run this command:
chmod +x jdk-1_5_0_
3. Change directory to the location where you would like the files to be installed.
The next step installs the JDK into the current directory.
4. Run the self-extracting binary.
Execute the downloaded file, prepended by the path to it. For example, if the file is in the current directory, prepend it with “./” (necessary if “.” is not in the PATH environment variable):
]# ./jdk-1_5_0_
The binary code license is displayed, and you are prompted to agree to its terms.
The JDK files are installed in a directory called jdk1.5.0_
Installation of RPM Packages
Use these instructions, If you want to install RPM packages.
1. Download and check the download file size to ensure that you have downloaded the full, uncorrupted software bundle.
Before you download the file, notice its byte size provided on the download page on the web site. Once the download has completed, compare that file size to the size of the downloaded file to make sure they are equal.
2. Make sure that execute permissions are set on the RPM Packages.
Run this command:
chmod +x jdk-1_5_0_
3. Start the installation process. Type:
]# ./jdk-1_5_0_
The binary code license is displayed, and you are prompted to agree to its terms.
4. The installation file creates jdk-1_5_0_
5. Run the RPM command at the terminal to install the packages. Type:
rpm -iv jdk-1_5_0_
6. The JDK is installed in jdk-1_5_0_
Note about Root Access: Unbundling the software automatically creates a directory called jdk1.5.0_
Note about Overwriting Files: If you unpack the software in a directory that contains a subdirectory named jdk1.5.0_
(B) Create links for the JDK by entering the following commands:
]# ln -s /usr/java/jdk1.5.0_06 /usr/local/jdk1.5.0_06
]# ln -s /usr/local/jdk1.5.0_06 /usr/local/jdk
(C) Stack components like JBoss and Tomcat need JAVA_HOME set properly before prior to operation. Create the system files: /etc/profile.d/java.sh and java.csh to export the following environment variables:
JAVA_HOME=/usr/local/jdk
PATH=$JAVA_HOME/bin:$PATH
NOTE:
The shells bash and cshell use a different syntax for setting environment variables.
- For java.sh include the lines:
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$PATH
- For java.csh include the lines:
setenv JAVA_HOME /usr/local/jdk
setenv PATH $JAVA_HOME/bin:$PATH
You can either use setenv or declare -x to declare the path in .csh file.
If you get any error like bad discriptor after running that .csh file, you can directly declare the path using following command.
]# export PATH=”$PATH:/usr/local/jdk-version”
(D) To verify that the installation was successful, at the prompt enter:
]# java –version