Monday, February 27, 2012

Installing Sun JDK 1.6.0 in CentOS 5.5

Installing Sun Java JDK in CentOS is not as easy as I expected
If you want to use Java Sun JDK instead of OpenJDK on CentOS, u have to install it manually.
1. Download the Java Sun JDK (.rpm.bin) at Sun Homepage
2. Login the CentOS as root and modify the privilege of the .bin to 755

3. The installed java can be found at /usr/java

4. Add this new java to the alternatives configuration
  • alternatives –install /usr/bin/java java /usr/java/jdk1.6.0_18/bin/java 2

5. Update the java alternatives and verify the java version

OR
In Short:
STEP 1: Download the Sun Java JDK from the Java SE Downloads page.
STEP 2: Using your root account, or the sudo command, run the jdk-6u11-linux-i586-rpm.bin (chmod it if necessary). This will install Java packages.
STEP 3:
For selecting the java command, we can use the alternatives program. Use:

/usr/sbin/alternatives --install /usr/bin/java java /usr/java/latest/bin/java 2

Now run

/usr/sbin/alternatives --config java

and select option 2.
Running java -version now should show Sun JVM info.

No comments:

Post a Comment