Installing Java on CentOs

Java is available in CentOS 5.

root@server70 [~]# yum list|grep openjdk
java-1.6.0-openjdk.x86_64                  1:1.6.0.0-1.2.b09.el5       installed
java-1.6.0-openjdk-demo.x86_64             1:1.6.0.0-1.2.b09.el5       updates
java-1.6.0-openjdk-devel.x86_64            1:1.6.0.0-1.2.b09.el5       updates
java-1.6.0-openjdk-javadoc.x86_64          1:1.6.0.0-1.2.b09.el5       updates
java-1.6.0-openjdk-src.x86_64              1:1.6.0.0-1.2.b09.el5       updates
root@server70 [~]#

To install java, run

yum install java-1.6.0-openjdk

Java will be installed on

/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/bin/java
root@server70 [/var/log]# rpm -q --filesbypkg java-1.6.0-openjdk  | grep "/bin/java"
java-1.6.0-openjdk        /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/bin/java
root@server70 [/var/log]# which java
/usr/bin/java
root@server70 [/var/log]# cd /usr/bin
root@server70 [/usr/bin]# ls -la |grep java
lrwxrwxrwx  1 root root          22 Aug 25 02:56 java -> /etc/alternatives/java*
root@server70 [/usr/bin]# ls -la /etc/alternatives/java
lrwxrwxrwx 1 root root 46 Aug 25 02:56 /etc/alternatives/java -> /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java*
root@server70 [/usr/bin]#

Posted in Linux

  • Nataraj

    how to find the java home and path

  • admin

    On linux, you can find java path with following command

    which java