QueHow

A How-To and wiki Blog

  • Operating System
    • Windows
      • Windows 10
      • Windows 7
    • Linux
  • Software
    • Application Software
    • Microsoft Office
      • Outlook
      • Word
      • PowerPoint
  • Internet
    • Browsers
      • Mozilla Firefox
      • Google Chrome
    • CMS
    • Tips & Tricks
  • Website
    • ecommerce
    • Google
    • Social Networking
    • General Websites
  • Mobile
  • Email
    • Gmail
  • Wiki

How to Download and Install Oracle Java in Ubuntu

By Neha T Leave a Comment

Java is the prominent source to assist in developing and executing the applications or programs written in the Java language. The maker of Java is “Sun Microsystems” but now it is under “Oracle”. If we talk about its implementation, it is available in various suite such as Openjdk, Oracle Java, etc.

Here, we will discuss about how to download and install Oracle Java in Ubuntu. Now the question arises, why is it so? The major difference between the above two are:

  • Openjdk is a open source while the Oracle java is an implementation of it.
  • When it comes to the stability, Oracle java/ jdk is more stable than Openjdk.
  • The most important thing is how you are going to use it: If you want to use it for small program or for personal use then it is fine to use Openjdk. However, in need to build application for the commercial use then you must go for Oracle Java. As in Openjdk you may find the fatal errors and sometimes it crashes, which is not suitable for building the large applications.

We have explored enough for choosing Oracle Java to install. In addition to that Oracle Java Standard Edition comes with the Java Development Kit (JDK) + JavaFX Software Development Kit (SDK) + Java Runtime Environment (JRE) and many other tools.

Steps to Download and Install Oracle Java in Ubuntu

Step 1: For downloading the Oracle Java you need to visit the website www.oracle.com.

Go to the Downloads tab and click on it.

How-to-download-and-install-java-in-ubuntu-step1

Step 2: Check for the Java Downloads. Click on it, you will find the latest edition at the top i.e. Java SE 8u31. To download the Java Development Kit (JDK), hit on the “Download” button below it.

How-to-download-and-install-java-in-ubuntu-step2

Step 3: It will take some time to load, meanwhile open up the “Terminal” in your Ubuntu machine by pressing “Ctrl + Alt + T”. Then write the command “cd Downloads”, by default, the JDK will be stored in the download folder.

How-to-download-and-install-java-in-ubuntu-step3

Step 4: Check out the browser, whether you have redirected to the next page or not. As you can see in the figure, it’s done. So, I will choose “tar” file for Linux based system such as Ubuntu. But, be careful while selecting the Linux x64 or Linux 32 bit.

If your system is of 32 bit OS, download the Linux32 based zipped file and if, 64 bit so download Linux x64 file. In my case, it’s 64 bit, so I choose Linux x64 corresponding file.

For an example: If you try to install Linux x64 file on 32-bit Operating system, the system will encounter multiple errors and you would not be able to accomplish the task.

How-to-download-and-install-java-in-ubuntu-step4

Step 5: Once you click on “tar” file, downloading will get started. You”ll asked to save it, so click on “Save File” when a dialog box appears, click on“OK” button to proceed.

How-to-download-and-install-java-in-ubuntu-step5

Step 6: It will take few minutes depending upon your system’s Internet connectivity. Once it is complete, unzip the “tar” file. For that go to the terminal again and type the command “tar -xvf <filename>” such as “tar -xvf jdk-8u31-linux-x64.tar.gz” and press enter.

How-to-download-and-install-java-in-ubuntu-step6

Step 7: As you can see in the figure below, the file is now unzipped .

How-to-download-and-install-java-in-ubuntu-step-7

Step 8: Now my Terminal window is almost full, so in this case type: “clear” and  press enter. “Clear”command  is used to clean the terminal screen.

How-to-download-and-install-java-in-ubuntu-step8

Step 9: Make sure you are at “Downloads” path. Here, type “ls” command to check that JDK folder is created or not.

As you can see in the figure, it’s done.

How-to-download-and-install-java-in-ubuntu-step9

Step 10: You are now required to check the path named “usr/lib/java”. For that, search the file under “My Computer”.

In my case, I found that there is no folder named “Java”.

How-to-download-and-install-java-in-ubuntu-step10

Step 11: If you are having the same scenario,then let’s create a folder inside the desired path.

Firstly, you have to change the path, so type: “cd /usr/lib”.

How-to-download-and-install-java-in-ubuntu-step11

Step 12: After changing the Directory, type: “sudo mkdir java”. This will create a folder named java inside the path “usr/lib”.  mkdir command is used to create a directory, as you may know that folders in a Windows OS is termed as “Directories” in Linux Operating system.

How-to-download-and-install-java-in-ubuntu-step12

Step 13:  Done with that..great, now move to the path “usr/lib/java”. But, here you are already at usr/lib so you just need to change a single directory.

Simply type “cd java”, so that you may move to the desired path. This is done to ensure that the directory is successfully created.

How-to-download-and-install-java-in-ubuntu-step13

Step 14: To store the jdk folder inside the path which we are discussing above, you have to go to the “Downloads” where it is stored for now. You may find that you are in multiple directories, so to go directly to the downloads use the command “cd ~/Downloads”, it will lead you to the destination mentioned, irrespective of the present location.

How-to-download-and-install-java-in-ubuntu-step14

Step 15: Now type “sudo mv jdk1.8.0_31 /usr/lib/java” to move jdk folder to the destination /usr/lib/java, where “mv” stands for move.

This is done to properly store it in a particular path, that will be easy to search, as you will copy and paste it in Windows.

How-to-download-and-install-java-in-ubuntu-step15

Step 16: To cross check that the operation you have performed earlier is successfully done or not. Change the path from Downloads to “/usr/lib/java/jdk1.8.0_31/bin” For that type: “cd /usr/lib/java/jdk1.8.0_31/bin” where jdk1.8.0_31 is a folder of jdk with it’s version.

It may differ, if you have downloaded any other version of Java.

How-to-download-and-install-java-in-ubuntu-step16

Step 17: If done with that, just type “ls” command to list all the items stored in the desired destination. I have performed the same and got the output as shown below.

How-to-download-and-install-java-in-ubuntu-step17

Step 18: If you have multiple Java installed on your system for an example “openjdk”. So you need to instruct the system which one to use as default.

For that, firstly move one step back, type “cd ..” to go single step back in order to change the directory.

How-to-download-and-install-java-in-ubuntu-step18

Step 19: Now you are at the path “usr/lib/java/jdk1.8.0_31”. Then update the “alternatives” which is used to tell the system which command to use as a default.

Just type sudo update-alternatives –install “/usr/bin/java” “java” “/usr/lib/java/jdk1.8.0_31/bin/java” 1 and press enter. This is used for setting the “java” as an alternative.

How-to-download-and-install-java-in-ubuntu-step19

Step 20: After that do the same for the Java compiler as well i.e. “javac”. Type: sudo update-alternatives –install “/usr/bin/javac” “javac” “/usr/lib/jvm/jdk1.7.0_45/bin/javac” 1 and press enter.

You have done it.

How-to-download-and-install-java-in-ubuntu-step20

Step 21: Then return to the home path by giving the command: “cd ~”.

How-to-download-and-install-java-in-ubuntu-step21

Step 22: After this you have to edit the “bashrc” file. You may be thinking of what is bash? It stands for Bourne again shell, improved version of Bourne or sh shell. It is a command line interpreter that works with a text window and reads the instruction given in “.bashrc” file or standard input to execute it.

So, to edit bash file you can use any of the editor such as vim or gedit. Here, I am editing it with “gedit”, the basic text editor in Ubuntu. To open “bashrc” file with gedit type: “sudo gedit ~./bashrc”, by default, by default, it is present in the home directory that’s why used “~” sign, referring to the home directory.

How-to-download-and-install-java-in-ubuntu-step22

Step 23: Now, file will open up. Insert the lines mentioned below and save it using the “Save” option at the top:
#JAVA HOME DIRECTORY SETUP
export JAVA_HOME=/usr/lib/java/jdk1.8.0_31
export PATH=$PATH:$JAVA_HOME/bin

How-to-download-and-install-java-in-ubuntu-step23

Step 24: Hey, people finally you have configured the “Oracle Java” in your Ubuntu system. It’s time to test it, simply type “java”. You”ll get to see its usage and options that ensures it has successfully downloaded and installed.

How-to-download-and-install-java-in-ubuntu-step24

Step 25: Want to check the version of Java which you have installed, type “java -version”. The output will appear on your screen.

How-to-download-and-install-java-in-ubuntu-step25

NOTE: The above steps are discussed in brief so you may not come across any difficulty. Don’t get frustrated by just looking at these too many steps. I could have reduced it, but just for your safety , I didn’t.

You Might Also Like:

How to install and configure uTorrent server in Ubuntu 14.04 How we can Change the Directory in Ubuntu how-to-install-and-configure-apache-web-servers-in-ubuntuHow to Install and Configure Apache Web Server in Ubuntu How to install lamp (Linux, Apache, MySQL and Php) in Ubuntu 14.04 How to check and install java in Ubuntu 14.04 how-to-install-java-in-firefox-feature-imageHow to Install Java in Firefox install OneDrive in Windows 10 -featureimageHow to Download & Install OneDrive? download-and-install-zoom-feature-imageHow to Download and Install Zoom?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Most Viewed

  • How to Install and Use TELNET in Ubuntu
  • How to install Hindi fonts in MS Word
  • How to Change a File Extension in Windows 10?
  • How to create a flipkart account in 3 simple steps
  • How to Change Monitor Refresh Rate in Windows 10?
  • How to install IIS on Windows 10
  • How to Insert Clickable Checkbox in MS Word 2016?
  • How to Set Auto Reply in Outlook 2016?
  • How to Login as Administrator in Windows 10?
  • How to Check RAM Size and System Type in Windows 10?

Recent Additions

  • How to Add Hyperlink to Another Sheet in Excel?
  • How to Add and Remove Watermark in Excel
  • How to use Relative and Absolute Cell Reference in Excel?
  • How to Enable and Disable Scroll Lock in Excel?
  • How to Use INDEX and MATCH Functions in Excel?
  • How to Make Bar Graph in Excel?
  • How to Count Duplicate Values in Excel?
  • How to Wrap Text in Excel?
  • How to Round off Numbers in Excel?
  • How to Create a Bell Curve in Excel?

Related Searches

  • How to convert web page to PDF file
  • How to Reset Google Chrome Browser?
  • How to add sticky notes in PDF
  • How to enable numlock automatically in Ubuntu 14.04
  • How to add page numbers to PDF

Copyright © 2023 · QueHow · Contact Us