From 3b0c3ad0d28296cc95ed7f215391d604da65b354 Mon Sep 17 00:00:00 2001 From: cwlinode Date: Thu, 24 Jan 2019 14:13:42 -0500 Subject: [PATCH 1/2] Updated for JDK 11 --- .../install-java-on-ubuntu-18-04/index.md | 135 ++++++------------ 1 file changed, 41 insertions(+), 94 deletions(-) diff --git a/docs/development/java/install-java-on-ubuntu-18-04/index.md b/docs/development/java/install-java-on-ubuntu-18-04/index.md index 5521a7688b6..5c9469508b2 100644 --- a/docs/development/java/install-java-on-ubuntu-18-04/index.md +++ b/docs/development/java/install-java-on-ubuntu-18-04/index.md @@ -2,138 +2,85 @@ author: name: Linode Community email: docs@linode.com -description: Install the Oracle Java development kit -keywords: - - oracle - - java - - JDK - - install java - - ubuntu +description: Install the Oracle Java Development Kit on Ubuntu Bionic Beaver. +keywords: ["java", "oracle", "openjdk", "jdk"] license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)' -aliases: - - applications/development/install-java-on-ubuntu-18-04/ - - development/install-java-on-ubuntu-18-04/ -modified: 2018-08-06 +aliases: ['applications/development/install-java-on-ubuntu-18-04/','development/install-java-on-ubuntu-18-04/'] +modified: 2019-01-23 modified_by: - name: Phil Zona + name: Linode published: 2017-05-30T00:00:00.000Z -title: Install Java 10 on Ubuntu 18.04 +title: Install Oracle Java SE Development Kit 11 on Ubuntu contributor: name: Phil Zona link: 'https://github.com/pbzona' -external_resources: - - '[Oracle Java](https://www.oracle.com/java/index.html)' audiences: ["beginner"] languages: ["java"] --- -[Java](https://www.oracle.com/java/index.html) is one of the world's most popular programming languages. Java can be used to create anything from software to basic web applications. - -In this guide you will install the Oracle Java development kit (JDK) for building Java applications. This guide will also cover OpenJDK, an open-source alternative to the Oracle Java development kit. - -## Before You Begin - -1. Familiarize yourself with our [Getting Started](/docs/getting-started) guide and complete the steps for setting your Linode's hostname and timezone. - -2. This guide will use `sudo` wherever possible. Complete the sections of our [Securing Your Server](/docs/security/securing-your-server) to create a standard user account, harden SSH access, and remove unnecessary network services. +[Java](https://www.oracle.com/java/index.html) is one of the world's most popular programming languages and can be used to create anything from software to basic web applications. Java was orginally developed within Sun Microsystems which was subsequently bought by Oracle, so it's Oracle's Java platform which is usually the first which come to mind. There are others, however, such as [IBM Runtime](https://www.ibm.com/ca-en/marketplace/support-for-runtimes), [Red Hat](https://developers.redhat.com/products/openjdk/overview/), and [Zulu](https://www.azul.com/products/zulu-enterprise/). -3. Update your system: +Oracle has updated the JDK license with the release of version 11 to be significantly different than previously. In short, Oracle JDK is a paid commercial license but free for development use. - ``` - sudo apt update -y && sudo apt upgrade -y - ``` - -## Install Oracle JDK +It is Oracle's [OpenJDK](https://jdk.java.net/11) whhich is GPL licensed, and with exception to [cosmetic and packaging differences](https://blogs.oracle.com/java-platform-group/oracle-jdk-releases-for-java-11-and-later), the two development kits are identical. See Oracle's Java [download page and license](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html) to further help decide which version is appropriate for you. -The Oracle JDK includes a development environment for building applications with the Java programming language. Please be aware that some elements of the Oracle JDK are proprietary, meaning that there may be licensing implications with respect to applications you develop with it. +This guide demonstrates installing Oracle's Java Standard Edition Development Kit (Oracle JDK) on Ubuntu 18.04. Installing OpenJDK is also explained for a free and open source alternative. -1. Add the Java PPA: - ``` - sudo add-apt-repository ppa:linuxuprising/java - ``` - - {{< note >}} This repository is _not_ maintained by Oracle. It does not contain actual Java files, but does allow us to download installers for Oracle Java software. Before using the installers, you'll be prompted to accept a license agreement, which can be found in its entirety [here](http://www.oracle.com/technetwork/java/javase/terms/license/index.html). {{< /note >}} - -2. Update the local package cache: - - ``` - sudo apt update -y - ``` - -3. Install the metapackage: - - ``` - sudo apt install oracle-java10-installer -y - ``` +## Before You Begin - This package will run an installer for the Oracle JDK 10, which is the current stable release as of this publication. Two prompts will appear during installation requiring you to accept license agreements. Hit `Enter` to accept both. +- You will need root access to your Linode, or a [limited user account](/docs/security/securing-your-server/#add-a-limited-user-account) with `sudo` privilege. -4. Verify that Java and the Java compiler have been properly installed: +- Update your system. - ``` - java -version - javac -version - ``` + sudo apt update && sudo apt upgrade - As of this publication, these commands should return the following: - ``` - java version "10.0.2" 2018-07-17 - Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13) - Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode) +## Install Oracle JDK - javac 10.0.2 - ``` -5. Since the PPA only provides an installer, and not updates for the JDK itself, you may want to delete it when you're finished in order to keep your repositories organized: +The Linux Uprising [Oracle Java PPA](https://launchpad.net/~linuxuprising/+archive/ubuntu/java) contains packages with install scripts to download and install Oracle JDK from Oracle's website. Alternatively, you can manually [download the binaries](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html). - ``` - sudo add-apt-repository -r ppa:linuxuprising/java - ``` +1. Add the PPA to Ubuntu. Apt will automatically refresh the package cache. -## Set Java Home Environment + sudo add-apt-repository ppa:linuxuprising/java -Many applications include code or configurations that references the `JAVA_HOME` environment variable. This variable points them to the Java binary file, allowing them to run Java code. +1. Install the JDK. You'll be asked to agree to the licensing terms. -1. To set the variable for your system: + sudo apt install oracle-java11-installer - ``` - echo "JAVA_HOME=$(which java)" | sudo tee -a /etc/environment - ``` +1. If you want Oracle JDK as the system default, install `oracle-java11-set-default`: -2. Reload your system's environment variables: + sudo apt install oracle-java11-set-default - ``` - source /etc/environment - ``` +1. You can check the install was successful with `java -version`: -3. Verify the variable was set correctly: + {{< output >}} +root@ubuntu:~# java -version +java version "11.0.2" 2018-10-16 LTS +Java(TM) SE Runtime Environment 18.9 (build 11.0.2+7-LTS) +Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+7-LTS, mixed mode) +{{< /output >}} - ``` - echo $JAVA_HOME - ``` - This should return the path to the Java binary. +1. Reload `/etc/profile` or log out of your system and back in so the Java environment variables are set: -## OpenJDK + source /etc/profile -The above installation methods allow you to use the Oracle JDK, which is bound by licensing terms and includes proprietary components. OpenJDK provides an open-source alternative that is just as easy to install. + {{< output >}} +root@ubuntu:~# echo $JAVA_HOME +/usr/lib/jvm/java-11-oracle +{{< /output >}} -To install OpenJDK 11: -``` -sudo apt install openjdk-11-jdk -y -``` +## Install Oracle OpenJDK -The installation will provide you with the OpenJDK, which includes a runtime environment and compiler. This allows you to develop your own Java applications and run them on your Linode. +OpenJDK includes a runtime environment and compiler which allows you to develop your own Java applications and run them on your Linode. If you only need to run Java applications which you've already downloaded, you can save some disk space by installing only the Java runtime environment. Both are available from Ubuntu's repository. -However, if you only need to run applications that you've already downloaded, you can save a bit of disk space by installing the OpenJRE (Java runtime environment): +- Install OpenJDK 11: -``` -sudo apt install openjdk-11-jre -``` + sudo apt install openjdk-11-jdk -Note that this is unnecessary if you've installed OpenJDK, since it includes the JRE. +- Install OpenJRE 11: -{{< caution >}} OpenJDK and Oracle Java are _not_ identical. There may be licensing, performance, and stability differences, and this should be considered carefully when developing production applications. {{< /caution >}} + sudo apt install openjdk-11-jre \ No newline at end of file From 0cba28ddab46b079d24ea758e3c7f044155716e5 Mon Sep 17 00:00:00 2001 From: leslitagordita Date: Mon, 28 Jan 2019 17:31:19 -0500 Subject: [PATCH 2/2] copy edit --- .../install-java-on-ubuntu-18-04/index.md | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/docs/development/java/install-java-on-ubuntu-18-04/index.md b/docs/development/java/install-java-on-ubuntu-18-04/index.md index 5c9469508b2..74089c81b33 100644 --- a/docs/development/java/install-java-on-ubuntu-18-04/index.md +++ b/docs/development/java/install-java-on-ubuntu-18-04/index.md @@ -6,10 +6,10 @@ description: Install the Oracle Java Development Kit on Ubuntu Bionic Beaver. keywords: ["java", "oracle", "openjdk", "jdk"] license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)' aliases: ['applications/development/install-java-on-ubuntu-18-04/','development/install-java-on-ubuntu-18-04/'] -modified: 2019-01-23 +modified: 2019-01-28 modified_by: name: Linode -published: 2017-05-30T00:00:00.000Z +published: 2017-05-30 title: Install Oracle Java SE Development Kit 11 on Ubuntu contributor: name: Phil Zona @@ -18,28 +18,27 @@ audiences: ["beginner"] languages: ["java"] --- -[Java](https://www.oracle.com/java/index.html) is one of the world's most popular programming languages and can be used to create anything from software to basic web applications. Java was orginally developed within Sun Microsystems which was subsequently bought by Oracle, so it's Oracle's Java platform which is usually the first which come to mind. There are others, however, such as [IBM Runtime](https://www.ibm.com/ca-en/marketplace/support-for-runtimes), [Red Hat](https://developers.redhat.com/products/openjdk/overview/), and [Zulu](https://www.azul.com/products/zulu-enterprise/). +[Java](https://www.oracle.com/java/index.html) is one of the world's most popular programming languages and can be used to create anything from software to basic web applications. Java was originally developed at Sun Microsystems, which was bought by Oracle. For this reason, Oracle's Java platform is the most well known. However, there are other such as [IBM Runtimes](https://www.ibm.com/us-en/marketplace/support-for-runtimes), [Red Hat's Open JDK](https://developers.redhat.com/products/openjdk/overview/), and [Zulu](https://www.azul.com/products/zulu-enterprise/). -Oracle has updated the JDK license with the release of version 11 to be significantly different than previously. In short, Oracle JDK is a paid commercial license but free for development use. +With the release of version 11, Oracle has updated the JDK license to be significantly different from previous versions. Oracle JDK is now a paid commercial license, but free for development use. -It is Oracle's [OpenJDK](https://jdk.java.net/11) whhich is GPL licensed, and with exception to [cosmetic and packaging differences](https://blogs.oracle.com/java-platform-group/oracle-jdk-releases-for-java-11-and-later), the two development kits are identical. See Oracle's Java [download page and license](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html) to further help decide which version is appropriate for you. +Oracle's [OpenJDK](https://jdk.java.net/11) is GPL licensed. With the exception of [cosmetic and packaging differences](https://blogs.oracle.com/java-platform-group/oracle-jdk-releases-for-java-11-and-later), the OpenJDK and Java SE (Standard Edition) development kits are identical. See Oracle's Java [download page and license](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html) to further decide which version is appropriate for you. This guide demonstrates installing Oracle's Java Standard Edition Development Kit (Oracle JDK) on Ubuntu 18.04. Installing OpenJDK is also explained for a free and open source alternative. ## Before You Begin -- You will need root access to your Linode, or a [limited user account](/docs/security/securing-your-server/#add-a-limited-user-account) with `sudo` privilege. +- You will need root access to your Linode, or a [limited user account](/docs/security/securing-your-server/#add-a-limited-user-account) with `sudo` privileges. -- Update your system. +- Update your system: sudo apt update && sudo apt upgrade ## Install Oracle JDK - -The Linux Uprising [Oracle Java PPA](https://launchpad.net/~linuxuprising/+archive/ubuntu/java) contains packages with install scripts to download and install Oracle JDK from Oracle's website. Alternatively, you can manually [download the binaries](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html). +The Linux Uprising [Oracle Java PPA](https://launchpad.net/~linuxuprising/+archive/ubuntu/java) uses packages that include install scripts to download and install the Oracle JDK from Oracle's website. Alternatively, you can manually [download the binaries](https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html). 1. Add the PPA to Ubuntu. Apt will automatically refresh the package cache. @@ -53,17 +52,19 @@ The Linux Uprising [Oracle Java PPA](https://launchpad.net/~linuxuprising/+archi sudo apt install oracle-java11-set-default -1. You can check the install was successful with `java -version`: +1. Check that the install was successful with the following command: + + java --version {{< output >}} -root@ubuntu:~# java -version +root@ubuntu:~# java --version java version "11.0.2" 2018-10-16 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.2+7-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+7-LTS, mixed mode) {{< /output >}} -1. Reload `/etc/profile` or log out of your system and back in so the Java environment variables are set: +1. Reload `/etc/profile` or log out of your system and back in to set the Java environment variables: source /etc/profile @@ -75,7 +76,7 @@ root@ubuntu:~# echo $JAVA_HOME ## Install Oracle OpenJDK -OpenJDK includes a runtime environment and compiler which allows you to develop your own Java applications and run them on your Linode. If you only need to run Java applications which you've already downloaded, you can save some disk space by installing only the Java runtime environment. Both are available from Ubuntu's repository. +OpenJDK includes a runtime environment and compiler which allows you to develop your own Java applications and run them on your Linode. If you only need to run Java applications which you've already downloaded, you can save some disk space by only installing the Java runtime environment. Both are available from Ubuntu's repository. - Install OpenJDK 11: