Friday, February 11, 2011

Installing Java in Fedora


Installing Java in Fedora

I need to install java in Fedora for me to learn java development in linux base environment. Here is the step:

1. First download a version of Java you will like to install in this website. Here is choose Java SE Development Kit 6 and Java SE Runtime Environment 6.

Note: select the rpm.bin package not .rpm.

2. Open Terminal then change to root user by:

su -

then type on the password of root

3. Run Sun JDK binary by using:

sh /path/jdk-6u23-linux-*-rpm.bin

where path = the location of the binary
note: Use full file name (without asterisk) if you have both i586 and x64 versions downloaded.
note: if you wish to register you can.

4. Run Sun Java Jre Binary by using:

sh /path/jre-6u23-linux-*-rpm.bin

where path = the location of the binary
note: Use full file name(without asterisk if you have both i586 and x64 versions downloaded.

5. Install Sun JDK java, javaws, libjavaplygin.so and javac using alternatives -install command:

## java ##
alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_23/jre/bin/java 20000
## javaws (32-bit only) ##
alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.6.0_23/jre/bin/javaws 20000

## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jdk1.6.0_23/jre/lib/i386/libnpjp2.so 20000

## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jdk1.6.0_23/jre/lib/amd64/libnpjp2.so 20000

## Install javac only if you installed JDK (Java Development Kit) package ##
alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_23/bin/javac 20000

6. Install Sun java, javaws and libjavaplugin.so using alternatives -install command:

## java ##
alternatives --install /usr/bin/java java /usr/java/jre1.6.0_23/bin/java 20000

## javaws (32-bit only) ##
alternatives --install /usr/bin/javaws javaws /usr/java/jre1.6.0_23/bin/javaws 20000

## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jre1.6.0_23/lib/i386/libnpjp2.so 20000

## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jre1.6.0_23/lib/amd64/libnpjp2.so 20000

5. Check current java, javac, javaws and libjavaplugin.so versions

java -version
javac -version
javaws

open mozilla firefox and write about:plugins on address bar

To swap between OpenJDK and Sun JDK version use:
alternatives --config java

You can also add JAVA_HOME environment variable to /etc/profile or $HOME/.bash_profile file using:
export JAVA_HOME=¨user/java/jdk1.6.0_23¨


1 comment: