This is a beginner tutorial on how to install Oracle’s Java JDK 7 (Java Development Kit) in Linux. The Linux distribution I use in this tutorial is the 64-bit Fedora 17.
1. Get the current release of Java here.
2. Click Download under the JDK option as shown in the picture below.
3. In the next page, there are a few releases for different OS such as Windows, Mac and Linux that are available for download. We can see for Linux itself it has four version as shown in the table.
4. Accept the Licence Agreement first and choose the one for Linux x64(64 bit) link. In this case, we specifically choose jdk-7u7-linux-x64.tar.gz since the OS we are using is Linux Fedora 17 64 bit.
5. Save the file inside the home folder. After it has finished downloading, open Terminal and make sure that it is in home folder.
6. Un tar the downloaded file just now by typing the command tar -zxvf jdk-7u7-linux-x64.tar.gz
7. Rename the resultant folder from jdk1.7.0_07 to jdk.
8. Next, we need to open and edit .bash_profile by typing vi .bash_profile
9. After that, this will come out.
10. Press ‘i’ on the keyboard and make sure to edit the file similar to diagram below. And make sure also to change ‘user‘ according to your own username. Say your username is admin1 so in this case “/home/user/jdk” should be typed as “/home/admin1/jdk“.
11. When it is done, press Esc button, then type : x (that’s colon and x close together. Couldn’t put together or else the emoticon will comes out instead) to save and quit the .bash_profile.
12. Execute the .bash_profile by typing . .bash_profile . As shown here.
13. Log out from Fedora then re-login.
14. To check where is Java and what version of Java that you have installed can be done by using these commands which java , java -version . Examples shown here.
Congratulations! You have installed JDK 7 into your Fedora 17.