How to install java jdk on fedora core (linux)

How to install java jdk on fedora core? here i provide few steps to demonstrate how it’s work.

Installation Setup

1 ) Please visit sun java website to download any java jdk version you like.
http://java.sun.com/javase/downloads/index.jsp

2 ) Click download, select Linux platform, language and accept license and continue.

3 ) Select “Linux RPM in self-extracting file” and download jdk_filename-rpm.bin file (jdk-6u6-linux-i586-rpm.bin).

4 ) After downloaded, changed to the directory where you saved the file.

5 ) login to root user or su to root or sudo, and issue ‘chmod +x jdk_filename.-rpm.bin’ to make it executable.

chmod +x jdk_filename.bin

6 ) Execute it

./jdk_filename-rpm.bin

7 ) Press space bar , repeat until system prompt to enter yes or no, type y and enter to continue.

8 ) This will output a .rpm file in same directory

9 ) Issue ‘rpm -i jdk_filename.rpm’, this will install all jdk files on linux system /usr/java/jdk-version/

rpm -i jdk_filename.rpm

10 ) Create symbol links to make it execute anywhere

 ln -s /usr/java/jdk1.6.0/bin/java /usr/bin/java
 ln -s /usr/java/jdk1.6.0/bin/javac /usr/bin/javac

11 ) type java -version, DONE !!

Post-Installation Setup

Set JAVA_HOME into environment variable

Copy following statement and append to /etc/profile or .bashrc file, make system set JAVA_HOME into system environment variable.

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

P.S Please visit How to install JDK on Ubuntu, if you want to know how to install java jdk with apt-get.

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
11 Comment threads
3 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
12 Comment authors
dattatraya shelkehadiAmithanhanSpikey360 Recent comment authors
newest oldest most voted
dattatraya shelke
Guest
dattatraya shelke

i have installed fedora on my machine but i am unable to run the java program like jdbc connectivity program, servlet program , jsp program so plz provide steps for that.

hadi
Guest
hadi

Thanks very much … It really helped

Amit
Guest
Amit

hi all,
can you tell me how to install jdk in fedora 17
thanks in advance .

Amit
Guest
Amit

hi.
i have installed FEDORA 17 .
but i am not able to run the java program.
plzzz help .

hanhan
Guest
hanhan

Why in the line export JAVA_HOME=”/usr/java/jdk1.6.0;” there is a “;” at the end?

Spikey360
Guest
Spikey360

Great walkthrough. Works like hot knife on butter. The simplest and possibly the best. Thank you for posting.

Gabriel
Guest
Gabriel

Thanks for this good summary. But instead of doing symbolic links, it can be good to attach it to update-alternatives.

I found at this place http://www.code-complete.com/code/index.php?/archives/46-using-update-alternatives-to-add-additional-java-versions-to-etcalternatives.html a good way to do it
# update-alternatives –install “/usr/bin/java” “java” “/usr/java/default/bin/java” 3
# update-alternatives –install “/usr/bin/javac” “javac” “/usr/java/default/bin/javac” 3
# update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/java/default/bin/javaws” 3

then
# update-alternatives –config java

mifkent
Guest
mifkent

Terima Kasih banyak mas, ini sangat membantu saya, karena saya masih awam di linux.
sekali lagi terima kasih

vivek
Guest
vivek

thanks for the guide pal. FEDORA 12 users must type “JDK” INSTEAD OF “JRE” type “./jre-6u18-linux-i586-rpm.bin” and then “rpm -i jre-6u18-linux-i586.rpm”. process goes then smoothly.

vivekvaddinavivek@gmail.com -07/02/10.

dan
Guest
dan

you ledgend, I’ve followed about twenty guides on this tonight and none went as smoothly as this.

Marcel
Guest
Marcel

You forgot test java with command:
java -version

If will appear the error you should check the symlinks to /usr/bin/java

For CentOS – process is similar: Install Java on CentOS