Using a PPA
You can use WebUpd8 PPA (this will download the required files from Oracle and install JDK 8):
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
Are PPA's safe to add to my system and what are some “red flags” to watch out for?
Also ensure your JAVA_HOME
variable has been set to:
/usr/lib/jvm/java-8-oracle
For this you can use the following command (see step 3 of Manual Install to see how to make it permanent):
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
Manual install
The tar.gz provided by Oracle don't have an actual installation process. You just extract those files to a location you want and add them to your path. So the process is the following:
- Download a
.tar.gz
from Oracle (here I will be usingjdk-8u20-linux-x64.tar.gz
); - Extract it to somewhere;
-
Move the extracted folder to
/usr/lib/jvm
. This is not required but it is the place where Java runtime software is installed, and where tools like IDE's may search for it:sudo mv /path/to/jdk1.8.0_20 /usr/lib/jvm/oracle_jdk8
-
Before addin this jdk as an alternative, you can see that the new alternative is not listed:
sudo update-alternatives --query java sudo update-alternatives --query javac
-
Next, add the new jdk alternatives (2000 is the priority and feel free to pick a different number):
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/oracle_jdk8/jre/bin/java 2000 sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/oracle_jdk8/bin/javac 2000
-
Now you should see the new jdk listed and you can switch between the alternatives with this command:
sudo update-alternatives --config java sudo update-alternatives --config javac
-
Create a file
/etc/profile.d/oraclejdk.sh
with the following content (adapt the paths to reflect the path where you stored your JDK):export J2SDKDIR=/usr/lib/jvm/oracle_jdk8 export J2REDIR=/usr/lib/jvm/oracle_jdk8/jre export PATH=$PATH:/usr/lib/jvm/oracle_jdk8/bin:/usr/lib/jvm/oracle_jdk8/db/bin:/usr/lib/jvm/oracle_jdk8/jre/bin export JAVA_HOME=/usr/lib/jvm/oracle_jdk8 export DERBY_HOME=/usr/lib/jvm/oracle_jdk8/db
Done! Those paths will only be recognized after you logout or restart, so if you want to use them right away run source /etc/profile.d/oraclejdk.sh
.
相关推荐
在Ubuntu系统上安装SSH(Secure Shell)是连接远程服务器、进行安全远程操作的重要步骤。SSH是一种网络协议,用于安全地远程登录到服务器,执行命令、传输文件等操作。本指南将详细阐述如何在Ubuntu上安装并配置SSH...
在Ubuntu系统上安装OpenJDK的详细步骤 OpenJDK(Open Java Development Kit)是Java开发工具包的一个开源实现,它提供了运行Java应用程序所需的环境。对于开发者和系统管理员来说,安装OpenJDK在Ubuntu上是相当简单...
在文档 `How to install apache on ubuntu.docx` 中,可能会包含更详细的步骤、注意事项以及可能遇到的问题及其解决方法。记得查阅该文档以获取完整的信息。 总的来说,安装Apache在Ubuntu上是一个简单的过程,但...
GRANT ALL PRIVILEGES ON your_database.* TO 'newuser'@'localhost'; FLUSH PRIVILEGES; ``` 最后,退出MySQL客户端: ```sql EXIT; ``` 现在,新用户可以使用用户名和密码登录MySQL并进行数据操作。 记得定期...
How-to-Make-a-Computer-Operating-System, 在 C 中,如何制作计算机操作系统 如何使计算机操作系统关于如何从头开始编写 C/C 操作系统的在线书籍。注意 : 这个存储库是我旧课程的一个。 我的第一个项目是我在高中时...
how-to-write-a-great-research-paper-wiley-keys-to-success.pdf
Linux "how-to"手册是一系列详细的指南,专为Linux用户和管理员提供操作步骤和技术说明。这些手册涵盖了Linux系统中的各种主题,旨在帮助用户理解和解决特定问题。以下是对压缩包文件中部分子文件名称的解释,以及...
how-to-be-a-programmer-zh
如果您看到“Welcome to nginx”的页面,那么您已经成功安装了 Nginx 服务器。现在,您可以继续安装 Lemp Stack 或设置 FTP 服务器等。 小结 在本教程中,我们学习了如何在 CentOS 6 上使用 yum 安装 Nginx 服务器...
李开复展示:How-to-Presentation
how-to-read-a-paper教你怎样有效地阅读一篇科技文献
这个是合集~一般是这里最全的了 另外加的 PDF是英文的 .为 GCC4.1的HOWTO <br>目录 <br>ADSM-Backup-html<br>Advocacy<br>Automount-html<br>Battery-Powered-html<br>BootPrompt-HOWTO<br>Bridge-......
how-to-npm, 模块,教你如何模块 how-to-npm 模块,教你如何模块。先决条件要使用这个项目,你需要 NodeJS 。 访问 http://www.nodejs.org 下载并了解更多信息 !用法npm i -g how-to-npm
藏经阁-SS7-Attacker-Heaven-Turns-Into-Riot-How-To-Make-Nation-State-And-Intelligence-Attackers-Lives-Much-Harder-On-Mobile-Networks.pdf
例如,如果这个库已经上传到了PyPI(Python Package Index),那么可以运行`pip install How-To-Make-Free-money-cash-app-2.1.1`进行安装。然后,在Python代码中,通过import语句导入并调用库中的函数或类。 总的...
描述 "HowTo : Questasim on Ubuntu 16.04" 提示这是一个指导性的教程,将详细介绍在Ubuntu 16.04 LTS(长期支持版)这个Linux发行版上安装和配置Questasim的步骤。Ubuntu 16.04是基于Debian的Linux操作系统,因其...
Bioinformatics-with-Python-Cookbook-Learn-how-to-use-modern-Python-bioinformatics-libraries-and-applications-to-do-cutting-edge-research-in-computational-biology.pdf
- "How to unwrap PL/SQL-BH-US-06-Finnigan.pdf"可能是对这个主题的详细讲解,涵盖了PL/SQL的解析和调试技巧。 - Oracle官方文档是了解PL/SQL的权威来源。 - 在线教程、论坛和社区(如Stack Overflow)提供了...
How-to-Use-SAMA5D2-GPIO-Under-Linux-00003293a.pdf
how-to-create-devoted-customers1146