Do you want to know how to check and install java?. By default Java Runtime Environment (JRE) or you can simply say Java is not installed on the Linux-based operating system. So, that is why first you have to check the java version and then install the package according to your need.
Just have a glance at this article to find out how to check and install java version.
Steps to check and install Java:
Step 1: First of all we have to check the java version, for that just type: “java -version” and then press enter.
Step 2: If your system doesn’t have Java installed then you may get following output as shown in the image below. Here, you’ll see a list of Java packages, and you can select the package according to your need. Use “sudo apt-get install <selected package>”to install any package and then hit enter.
Step 3: Type: “sudo apt-get update” in order to update all the packages before installing Java.
Step 4: Now, type: “sudo apt-get install openjdk-6-jre-headless” and then hit enter.
Step 5: Press Y (yes) when prompted “Do you want to continue? [Y/N]”.
Step 6: Now, again type: “java -version” to check whether java gets installed in your system. If it is installed, then you’ll get the following message as shown in the image below. The output may differ according to your java package.
That’s all friends. Keep Reading.