Installing Java on Linux

Download the JDK from the Java website. The simplest way is to use wget. Example:

[root@server ~]# wget http://cds.sun.com/is-bin/ ... jdk-6u23-linux-x64-rpm.bin

Modify permissions to execute the .bin file:

[root@server ~]# chmod +x jdk-6u23-linux-x64-rpm.bin

Run the .bin file:

[root@server ~]# ./jdk-6u23-linux-x64-rpm.bin

Once complete, the JDK should be installed to /usr/java/. Quick test to see if Java is working correctly:

[root@server ~]# java -version
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) 64-Bit Server VM (build 19.0-b09, mixed mode)

Set the JAVA_HOME environment variable:

[root@server ~]# echo "export JAVA_HOME=/usr/java/default" > /etc/profile.d/java.sh

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>