Wednesday, June 9, 2010

Java installation on linux box.

Install java on linux machine  (http://www.meritonlinesystems.com/docs/apache_tomcat_redhat.html)

DOwnload page for java : http://java.sun.com/j2se/1.4.2/download.html

I chose the J2SE v1_4_2_12 SDK Linux self-extracting binary file. (j2re-1_4_2_12-linux-i586.bin,j2sdk-1_4_2_12-linux-i586.bin present in /usr/local/java directory)

1.Change to the directory where you downloaded the SDK and make the self-extracting binary executable:

chmod +x j2sdk-1_4_2_12-linux-i586.bin

2.Run the self-extracting binary:

./j2sdk-1_4_2_12-linux-i586.bin

3.There should now be a directory called j2sdk1.4.2.12 in the download directory.
Move the SDK directory to where you want it to be installed. I chose to install it in /usr/local/java.
Create /usr/local/java if it doesn't exist. Here is the command I used from inside the download directory:

mv j2sdk1.4.2.12 /usr/local/java

4.Set the JAVA_HOME environment variable, by modifying /etc/profile so it includes the following:
JAVA_HOME="/usr/local/java/j2sdk1.4.2.12"
export JAVA_HOME

Note : /etc/profile is run at startup and when a user logs into the system, so you will need to log out and log back in for JAVA_HOME to be defined.
exit
su -

5.Check to make sure JAVA_HOME is defined correctly using the command below. You should see the path to your Java SDK.
echo $JAVA_HOME

also do following if java not orking
PATH=$PATH:/usr/java/j2sdk1.4.2_03­ /bin
JAVA_HOME=/usr/java/j2skd1.4.2_03
export PATH


Installation of RPM File

It requires root access to install.

1. Run the rpm command to install the packages that comprise the Java 2 SDK:

rpm -iv jdk-6u2-linux-i586.rpm

2. Delete the bin and rpm file if you want to save disk space.



Note: By default, the .rpm is installed in /usr/java. Use which javac to ensure the classpath was setup correctly.

TO Uninstall any rpm use following command
rpm -e

No comments:

Post a Comment