Sunday, May 19, 2013

How to Install Sun Java JDK6 On Fedora 17/18

                                        How To Install Sun Java JDK6 On Fedora17/18


installing java on linux


The following are the steps to install a Sun JDK6 in Fedora. 

Step-1: Download the Java Jdk6 from the below link:
Download

After downloading you can get the rpm file( for example jdk-6u35-linux-x64-rpm.bin )

Step-2: Open terminal and copy the above file into any location. I am copying the above rpm file into following location
[ranga@ranga java]$ pwd
/home/ranga/install/java


[ranga@ranga java]$ ./jdk-6u35-linux-x64-rpm.bin
bash: ./jdk-6u35-linux-x64-rpm.bin: Permission denied
The above error you can get because of there is no permission to execute the above rpm file.
[ranga@ranga java]# chmod +x jdk-6u35-linux-x64-rpm.bin
Change to root user by using su command
[ranga@ranga java]$ su
Password:
[root@ranga java]# chmod +x jdk-6u35-linux-x64-rpm.bin
[root@ranga java]# ./jdk-6u35-linux-x64-rpm.bin
Unpacking...
Checksumming...
Extracting...
UnZipSFX 5.50 of 17 February 2002, by Info-ZIP (Zip-Bugs@lists.wku.edu).
  inflating: jdk-6u35-linux-amd64.rpm 
  inflating: sun-javadb-common-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-core-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-client-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-demo-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-docs-10.6.2-1.1.i386.rpm 
  inflating: sun-javadb-javadoc-10.6.2-1.1.i386.rpm 
Preparing...                ########################################### [100%]
   1:jdk                    ########################################### [100%]
Unpacking JAR files...
 rt.jar...
 jsse.jar...
 charsets.jar...
 tools.jar...
 localedata.jar...
 plugin.jar...
 javaws.jar...
 deploy.jar...
Installing JavaDB
Preparing...                ########################################### [100%]
   1:sun-javadb-common      ########################################### [ 17%]
   2:sun-javadb-core        ########################################### [ 33%]
   3:sun-javadb-client      ########################################### [ 50%]
   4:sun-javadb-demo        ########################################### [ 67%]
   5:sun-javadb-docs        ########################################### [ 83%]
   6:sun-javadb-javadoc     ########################################### [100%]

Java(TM) SE Development Kit 6 successfully installed.

Product Registration is FREE and includes many benefits:
* Notification of new versions, patches, and updates
* Special offers on Oracle products, services and training
* Access to early releases and documentation

Product and system data will be collected. If your configuration
supports a browser, the JDK Product Registration form will
be presented. If you do not register, none of this information
will be saved. You may also register your JDK later by
opening the register.html file (located in the JDK installation
directory) in a browser.

For more information on what data Registration collects and
how it is managed and used, see:
http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html

Press Enter to continue.....

Done.
[root@ranga java]# 


Now your installation is complete.

Step-3: Now you need to set the environment variables
There are two ways to set environment variables to the user wise.
1. Only particular user by using .bash_profile
2. Set to common to all users by using .profile
I am setting the the path to only particular user by using .bash_profile
Go to your home directory
 

[root@ranga java]$ cd
[root@ranga java]$ pwd
/home/ranga
[root@ranga ~]$ vi .bash_profile 
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

PATH=$PATH:$HOME/.local/bin:$HOME/bin
#export PATH

JAVA_HOME="/usr/java/jdk1.6.0_35"
export JAVA_HOME

export PATH=${JAVA_HOME}/bin:${PATH}
unset USERNAME

[root@ranga~]$. .bash_profile
Now check the JAVA_HOME setted properly or not by using following command.
 

[root@ranga~]$ echo $JAVA_HOME
/usr/java/jdk1.6.0_35
 

Step-4: Removing Open JDK

[root@ranga jdk1.6.0_35]# rpm -qa | grep java 

sun-javadb-core-10.6.2-1.1.i386 
sun-javadb-docs-10.6.2-1.1.i386 
tzdata-java-2013b-2.fc17.noarch 
sun-javadb-client-10.6.2-1.1.i386 
sun-javadb-javadoc-10.6.2-1.1.i386 
sun-javadb-common-10.6.2-1.1.i386 
java-1.7.0-openjdk-1.7.0.19-2.3.9.1.fc17.x86_64 
sun-javadb-demo-10.6.2-1.1.i386 
[root@ranga jdk1.6.0_35]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.19-2.3.9.1.fc17.x86_64
[root@ranga jdk1.6.0_35]# rpm -qa | grep java
sun-javadb-core-10.6.2-1.1.i386
sun-javadb-docs-10.6.2-1.1.i386
tzdata-java-2013b-2.fc17.noarch
sun-javadb-client-10.6.2-1.1.i386
sun-javadb-javadoc-10.6.2-1.1.i386
sun-javadb-common-10.6.2-1.1.i386
sun-javadb-demo-10.6.2-1.1.i386

Final step is reboot your system. 

[root@ranga jdk1.6.0_35]# reboot
After rebooting check once again which java installed.
[ranga@ranga ~]$ which java
/usr/java/jdk1.6.0_35/bin/java
[ranga@ranga ~]$ java -version
java version "1.6.0_35"
Java(TM) SE Runtime Environment (build 1.6.0_35-b10)
Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01, mixed mode)

0 comments: