Are you a java programmer/learner? And working Java in windows platform? But do you know that it is also possible to do it in Linux platform, to do this you have to install and configure java software and it’s environment variable in Linux. So, now I am going to installing jdk 1.6 on Red Hat Enterprise Linux 5.4 you can also do it with other Distribution of Linux. So follow the steps as i have done.
Step-1: Create a folder named JDK1.6 in to root directory & keep the software into it.
[root@dbsrv ~]# mkdir /JDK1.6
Step-2: Now make sure that you have put the software into /JDK1.6 directory
[root@dbsrv ~]# cd /JDK1.6
[root@dbsrv ~]# ls –la
Step-3: Now make the file to be executable, then unpack by executing it.
[root@dbsrv ~]# cd /JDK1.6
[root@dbsrv JDK1.6]# chmod +x jdk-6u24-linux-i586-rpm.bin
[root@dbsrv JDK1.6]# ./jdk-6u24-linux-i586-rpm.bin
Step-4: Now we need to check where the files is installed. To know this run this command
[root@dbsrv ~]# rpm –ql jdk
Configure Java environment on Linux
After installing Java Development Kit or Java Runtime Environment on Linux, you may still need to do some configuration to get Java ready for running or compiling Java programs. The following instruction will guide you through the process of setting up JDK for software development. JRE can be configured similarly.
Step-1:Create a link of jdk.
JDK is usually installed into /usr/java directory. Create a symbolic link to the installation directory. That way makes it easier to switch between different Java versions that you may have just by redirecting the link to the appropriate target directory.
[root@dbsrv ~]# ln –s /usr/java/jdk1.6.0_24 /usr/java/j2se
Step-2: Create a java.sh file in /etc/profile.d directory with content as follows:
[root@dbsrv ~]# cd /etc/profile.d
[root@dbsrv profile.d]# vi java.sh
export PATH JAVA_HOME JAVA_FONTS ANT_HOME
Step-3: Change the permission of java.sh file.
The java.sh file contains various shell commands which set and export necessary environment variables for Java. It assumes Apache Ant and Unicode TrueType fonts have been installed in appropriate directories. Ant is a tool widely used in building and executing Java applications. Shell settings from configuration files in the /etc/profile.d directory are gathered by /ect/profile during login, setting up user environment information for every user. Assign execute permissions:
[root@dbsrv profile.d]# chmod 755 java.sh
Step-4: You can verify the availability of Java to users after login by:
[root@dbsrv ~]# java –version
java version “1.6.0_24”
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Client VM (build 19.1-b02, mixed mode, sharing)