Install Java 8 on Ubuntu

发布时间:2019-11-17 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了Install Java 8 on Ubuntu脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

In this article, we will learn how to install Java 8 on ubuntu OS. We will install JDK in Ubuntu. Java is a PRogramming technoLOGy which is actually develoPEd by Sun MicroSystems. Java is free to download and use for commercial use.

Install Java 8 on Ubuntu
How to Install Java 8 on Ubuntu?

i) At First, we will download the package file From the official websITe.

http://www.oracle.com/technet... The download package is different for 64 bit and 32-bit versions.

ii) We will need some superuser privileges to install JDK. So we will use the following command-
sudo su

iii) The /opt directory is actually reserved for all the Software and add-on packages. This software is not part of the default installation. The command for creating the directory for JDK installation is-

mkdir /opt/jdk

Install Java 8 on Ubuntu


Creating a directory for JDK installation

iv) Then we will extract java into the /opt/jdk directory:

Install Java 8 on Ubuntu

tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk

Extract java into the /opt/jdk directory

v) Then we use the following command. This command verifies the file extraction into the /opt/jdk directory.

ls /opt/jdk

Install Java 8 on Ubuntu

Verifies the file extraction into the /opt/jdk directory

vi) By default, we can find java executable in /opt/jdk/jdk1.8.0_05/bin/java directory. To set it as the default JVM we will use:

update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_05/bin/java 100 update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_05/bin/javac 100

Install Java 8 on Ubuntu


@H_777_103@

Set the default JVM

Set the default JVM

vii) Then verify the java has been successfully configured. Run the following command-

update-alternatives --display java update-alternatives --display javac

Install Java 8 on Ubuntu


Install Java 8 on Ubuntu


Verify the java has been successfully configured

Verify the java has been successfully configured

We can check installation by-

java -version

Install Java 8 on Ubuntu

Check installation by java -version

viii) We can also update Java. Hence, download an updated version of oracle’s website and extract to the /opt/jdk directory. After that, set it as the default JVM with a higher priority number:

update-alternatives --install /usr/bin/java java /opt/jdk/jdk.new.version/bin/java 110 update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk.new.version/bin/javac 110  

脚本宝典总结

以上是脚本宝典为你收集整理的Install Java 8 on Ubuntu全部内容,希望文章能够帮你解决Install Java 8 on Ubuntu所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。