- Java installation on linux
- General Notes About Installing the JDK on Linux Platforms
- System Requirements for Installing JDK on Linux Platforms
- JDK Installation Instruction Notation for Linux Platforms
- Installing the JDK on Linux from Archive Files and RPM Packages
- Installing the 64-Bit JDK 11 on Linux Platforms
- Installing the 64-Bit JDK on RPM-Based Linux Platforms
- Установка Java в Linux
- Чем отличается JDK от JRE
- Установка Java в Linux своими руками
- Установка Java в Ubuntu
- JRE и JDK
- Установка Java в ArchLinux
- Установка Java в CentOS
- Выбор версии Java
- Ubuntu
- ArchLinux
- CentOS
- Настройка переменных окружения
- Выводы
- 5 Installation of the JDK and JRE on Linux Platforms
- General Notes About Installing the JDK and JRE on Linux Platforms
- System Requirements for Installing JDK and JRE on Linux Platforms
- JDK and JRE Installation Instruction Notation for Linux Platforms
- Installation of the JDK on Linux from Archive Binaries and RPM Packages
- Installing the 64-Bit JDK 10 on Linux Platforms
- Installing the 64-Bit JDK on RPM-Based Linux Platforms
- Installation of the JRE on Linux from Archive Binaries and RPM Packages
- Installing the 64-Bit JRE 10 on Linux Platforms
- Installing the 64-Bit JRE 10 on RPM-Based Linux Platforms
Java installation on linux
This topic describes the installation procedures of the JDK on the Linux platform, along with the system requirements.
General Notes About Installing the JDK on Linux Platforms
This topic describes general information about installing JDK 11 on Linux platforms.
Installing the JDK automatically creates a directory called jdk– 11 . interim.update.patch .
If you install Java SE Runtime Environment in a specific location such as /usr/jdk (for JDK) then you must log in with root credentials to gain the necessary permissions. If you do not have root access, then either install the Java SE Runtime Environment in your home directory or a subdirectory for which you have write permissions.
If you install the software in a directory that contains a subdirectory named jdk– 11 . interim.update.patch , then the new software overwrites files of the same name in that directory. Ensure that you rename the old directory if it contains files that you would like to keep.
By default, the installation script configures the system such that the backing store for system preferences is created inside the JDK installation directory as applicable. If the JDK is installed on a network-mounted drive, then the system preferences can be exported for sharing with Java runtime environments on other machines.
System Requirements for Installing JDK on Linux Platforms
See Oracle JDK Certified Systems Configurations for information about supported platforms, operating systems, and browsers.
JDK Installation Instruction Notation for Linux Platforms
Instructions for installing JDK contains a version notation that represents the Feature, Interim, and Update version information.
For example, if you are installing JDK 11 Interim 0, Update 0, and Patch 0, then the following string represents the name of the bundle:
Linux x64 systems: jdk- 11 . interim.update.patch _linux-x64_bin.tar.gz
Linux aarch64 (64-bit ARM) systems: jdk- 11 . interim.update.patch _linux-aarch64_bin.tar.gz
If a component has 0 as the suffix, it will be excluded.
Installing the JDK on Linux from Archive Files and RPM Packages
You can install the Java Development Kit (JDK) on a Linux platform from archive files or from Red Hat Package Manager (RPM) packages.
Installation can be performed by using one of the following processes:
From archive files ( .tar.gz ): This allows you to install a private version of the JDK for the current user into any location, without affecting other JDK installations. However, it may involve manual steps to get some of the features to work. See the following table for the options available for downloading and installing the JDK from archive files. The bundles are available for Linux x64 and Linux aarch64 (64-bit ARM) systems. Install the required bundle.
From RPM packages ( .rpm ): This allows you to perform a systemwide installation of the JDK for all users, and requires root access. See the following table for the options available for downloading and installing the JDK from Linux x64 and Linux aarch64 (64-bit ARM) RPM packages.
Downloading the JDK Installer
Access Java SE Downloads page and click Accept License Agreement . Under the Download menu, click the Download link corresponding your requirement.
The following table lists the options and instructions for downloading and installing the JDK 11 release on a Linux platform:
Download File | Instructions | Architecture (CPU Type) | Who Can Install |
---|---|---|---|
For Linux x64 systems: jdk- 11 . interim.update.patch _linux-x64.tar.gz | Installing the 64-Bit JDK 11 on Linux Platforms | Intel — 64-bit | Anyone |
For Linux aarch64 (64-bit ARM) systems: jdk- 11 . interim.update.patch _linux-aarch64.tar.gz | Installing the 64-Bit JDK 11 on Linux Platforms | ARM — 64-bit | Anyone |
For Linux x64 systems: jdk- 11 . interim.update.patch _linux-x64.rpm | Installing the 64-Bit JDK on RPM-Based Linux Platforms | Intel — 64-bit RPM-based Linux | Root |
For Linux aarch64 (64-bit ARM) systems: jdk- 11 . interim.update.patch _linux-aarch64.rpm | Installing the 64-Bit JDK on RPM-Based Linux Platforms | ARM — 64-bit RPM-based Linux | Root |
Installing the 64-Bit JDK 11 on Linux Platforms
You can install the JDK for 64-bit Linux from an archive file ( .tar.gz ). The .tar.gz archive file (also called a tarball) is a file that can be uncompressed and extracted in a single step.
- For Linux x64 systems: jdk- 11 . interim.update.patch _linux-x64_bin.tar.gz
- For Linux aarch64 (64-bit ARM) systems: jdk- 11 . interim.update.patch _linux-aarch64_bin.tar.gz
Before you download a file, you must accept the license agreement. Anyone (not only root users) can install the archive file in any location having write access.
$ tar zxvf jdk- 11 . interim.update.patch _linux-x64_bin.tar.gz
$ tar zxvf jdk- 11 . interim.update.patch _linux-aarch64_bin.tar.gz
The Java Development Kit files are installed in a directory called jdk- 11 . interim.update.patch .
Installing the 64-Bit JDK on RPM-Based Linux Platforms
You can install the JDK on 64-bit RPM-based Linux platforms, such as Oracle, Red Hat, and SuSE by using an RPM binary file ( .rpm ) in the system location.
- For x64 systems: jdk- 11 . interim.update.patch _linux-x64_bin.rpm
- For aarch64 (64-bit ARM) systems: jdk- 11 . interim.update.patch _linux-aarch64_bin.rpm
Before you download a file, you must accept the license agreement.
$ rpm -ivh jdk- 11 . interim.update.patch _linux-x64_bin.rpm
$ rpm -ivh jdk- 11 . interim.update.patch _linux-aarch64_bin.rpm
JDK 11 can coexist with earlier versions of JDK. For each version, a new directory is created, the default directory being /usr/java/jdk- 11 . interim.update.patch .
Upgrade the required package using the following command:
$ rpm -Uvh jdk- 11 . interim.update.patch _linux-x64_bin.rpm
$ rpm -Uvh jdk- 11 . interim.update.patch _linux-aarch64_bin.rpm
The JDK installation is integrated with the alternatives framework. After installation, the alternatives framework is updated to reflect the binaries from the recently installed JDK. Java commands such as java , javac , javadoc , and javap can be called from the command line.
Using the java -version command, users can confirm the default (recently installed) JDK version.
In addition, users can check which specific RPM package provides the java files:
Источник
Установка Java в Linux
В этой статье речь пойдёт о проприетарной версии Java. Часто происходят ситуации, когда пользователь пытается открыть какую-либо программу на Java, а она либо вообще не запускается, либо пытается это сделать с помощью OpenJDK (Java Development Kit). Но вместо результата вы получаете кучу ошибок (как например с Minecraft). В данных ситуациях вам, скорее всего, поможет установка Java от Oracle.
Я вам расскажу, как установить JRE (Java Runtime Environment) и JDK (Java Development Kit) 8 версии на такие дистрибутивы, как Ubuntu, CentOS и Arch, а также как выбрать нужную среду по умолчанию.
Чем отличается JDK от JRE
- JRE — Java Runtime Environment — это среда выполнения Java. Предназначена для обычного использования. Позволяет запускать приложения, написанные на языке Java.
- JDK— Java Development Kit — стандартная версия платформы Java, предназначенная для разработки. Это специальный пакет разработчика, в который входят документация, различные утилиты, компилятор, библиотеки классов, а также сама JRE.
Установка Java в Linux своими руками
Скачать архив с необходимой вам версией вы можете с официального сайта. Далее вам надо перенести его в желаемую директорию и распаковать. Рекомендую /opt/java, далее она и будет использоваться. Сделайте это, используя следующие команды:
sudo tar -xzf /opt/java/jre*.tar.gz
Где «*» — версия Java.
Загрузите архив со средствами разработчки с официального сайта компании Oracle. Также перенесите его в желаемую директорию и распакуйте:
sudo tar -xzf /opt/java/jdk*.tar.gz
Установка Java в Ubuntu
JRE и JDK
Для установки проприетарной Oracle Java вам необходимо добавить репозиторий, обновить индексы пакетов и установить Java. В Ubuntu, начиная с 18 релиза, это делается автоматически после добавления репозитория.
Внимание! Будут установлены как JRE, так и JDK. Сначала добавим репозиторий и обновим списки пакетов:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
В процессе установки необходимо будет принять лицензионное соглашение:
sudo apt-get install oracle-java8-installer
Установка Java в ArchLinux
В официальных репозиториях есть только OpenJDK. Поэтому придётся воспользоваться пакетом из AUR(вы можете, конечно, руками установить Java от Oracle, но AUR проще). Установка производится всего одной командой:
JDK так же можно установить, используя AUR. Просто выполните команду:
Установка Java в CentOS
Для RHEL, Fedora, Cent OS, OpenSUSE есть официальный RPM-пакет, который вы можете скачать с официального сайта. Чтобы установить пакет из терминала, воспользуйтесь этой командой:
sudo rpm -i /путь/к/файлу/jre-*.rpm
где «*» — версия Java. Или же примените любую графическую утилиту.
Средства для разработчика вы можете скачать на сайте Oracle, ссылка на который есть в верху статьи. Для установки из терминала, используйте команду:
Где «*» — версия Java. «
» — указывает, что путь начинается.
Выбор версии Java
Ubuntu
Для переключения на 8 версию Java используйте следующую команду:
sudo update-java-alternatives -s java-8-oracle
Чтобы автоматически установить переменные среды, воспользуйтесь командой:
sudo apt-get install oracle-java8-set-default
Или же вы можете установить альтернативы сами. Делается это с помощью следующих команд:
sudo update-alternatives —install /usr/bin/java java / usr / lib / jvm / java-8-oracle/bin/java 1
sudo update-alternatives —install / usr / bin / javaс javaс / usr / lib / jvm / java-8-oracle / bin / javaс 1
sudo update-alternatives —install / usr / bin / javaws javaws / usr / lib / jvm /java-8-oracle / bin / javaws 1
Теперь осталось выбрать версии исполняемых файлов java, javaws и javac, которые будут использоваться по умолчанию:
sudo update-alternatives —config java
sudo update-alternatives —config javac
sudo update-alternatives —config javaws
ArchLinux
Для начала просмотрите список установленных сред:
Затем установите необходимую вам:
archlinux-java set имя_среды
archlinux-java set java-8-jre/jre
CentOS
Выбрать необходимую среду можно с помощью команд, данных ниже (так же, как и в Ubuntu). Вам нужно будет просто выбрать цифру, соответствующую номеру версии:
sudo update-alternatives —config java
sudo update-alternatives —config javac
sudo update-alternatives —config javaws
Настройка переменных окружения
Чтобы настройки были доступны для всех пользователей, будем использовать файл /etc/profile. Откройте его для редактирования любым текстовым редактором с помощью команды sudo и добавьте в конец следующие строки:
- export JAVA_HOME=/opt/java/jdk*/
- export JRE_HOME=/opt/java/jdk*/jre
- export PATH=$PATH:/opt/java/jdk*/bin:/opt/java/jdk*/jre/bin
- Вместо пути по умолчанию /opt/java укажите тот, который использовали;
- Если вы используете не JDK, а JRE, то в пути у вас так же будет не «jdk*», а «jre*»;
- «*» — версия Java, которая у вас установлена.
Выводы
В данной статье мы подробно разобрали процесс установки и настройки Java в различных дистрибутивах Linux. Если остались вопросы, спрашивайте в комментариях!
Источник
5 Installation of the JDK and JRE on Linux Platforms
This topic describes the installation procedures of the JDK and JRE on the Linux platform, along with the system requirements.
General Notes About Installing the JDK and JRE on Linux Platforms
This topic describes general information about installing JDK and JRE 10 on Linux platforms.
Installing the JDK automatically creates a directory called jdk– 10 . interim.update.patch . For the JRE, the software automatically creates a directory called jre– 10 . interim.update.patch .
If you install Java SE Runtime Environment in a specific location such as /usr/jdk (for JDK) or /usr/jre (for JRE), then you must log in with root credentials to gain the necessary permissions. If you do not have root access, then either install the Java SE Runtime Environment into your home directory or a subdirectory for which you have write permissions.
If you install the software in a directory that contains a subdirectory named jdk– 10 . interim.update.patch (for JDK) or jre– 10 . interim.update.patch (for JRE), then the new software overwrites files of the same name in that directory. Ensure that you rename the old directory if it contains files that you would like to keep.
By default, the installation script configures the system such that the backing store for system preferences is created inside the JDK or JRE’s installation directory as applicable. If the JDK or JRE is installed on a network-mounted drive, then the system preferences can be exported for sharing with Java runtime environments on other machines.
System Requirements for Installing JDK and JRE on Linux Platforms
See Oracle JDK Certified Systems Configurations for information about supported platforms, operating systems, and browsers.
JDK and JRE Installation Instruction Notation for Linux Platforms
Instructions for installing either JDK or JRE contains a version notation that represents the Feature, Interim, and Update version information.
For example, if you are installing JDK 10 Interim 0, Update 2, and Patch 1, then the following string represents the name of the bundle:
jdk- 10 . interim.update.patch -linux-x64_bin.tar.gz
Installation of the JDK on Linux from Archive Binaries and RPM Packages
You can install the Java Development Kit (JDK) on a Linux platform from archive binary files or from Red Hat Package Manager (RPM) packages.
Installation can be performed by using one of the following processes:
From archive binaries ( .tar.gz ): This allows you to install a private version of the JDK for the current user into any location, without affecting other JDK installations. However, it may involve manual steps to get some of the features to work. See the following table for the options available for downloading and installing the JDK from archive binaries.
From RPM packages ( .rpm ): This allows you to perform a systemwide installation of the JDK for all users, and requires root access. RPM-based Linux platforms are based on Red Hat and SuSE. See the following table for the options available for downloading and installing the JDK from RPM packages.
When you download and install the JDK, the associated Java Runtime Environment (JRE) is also installed.
The following table lists the options and instructions for downloading and installing the JDK 10 release on a Linux platform:
Download File | Instructions | Architecture | Who Can Install |
---|---|---|---|
jdk- 10 . interim.update.patch -linux-x64.tar.gz | Installing the 64-Bit JDK 10 on Linux Platforms | 64-bit | Anyone |
jdk- 10 . interim.update.patch -linux-x64.rpm | Installing the 64-Bit JDK on RPM-Based Linux Platforms | 64-bit RPM-based Linux | Root |
Installing the 64-Bit JDK 10 on Linux Platforms
You can install the JDK for 64-bit Linux, from an archive binary file ( .tar.gz ).
- Download the file, jdk- 10 . interim.update.patch _linux-x64_bin.tar.gz .
Before you download a file, you must accept the license agreement. The archive binary can be installed by anyone (not only by root users) in any location that you can write to.
The .tar.gz archive file (also called a tarball) is a file that can be simultaneously uncompressed and extracted in one step.
$ tar zxvf jdk- 10 . interim.update.patch _linux-x64_bin.tar.gz
The Java Development Kit files are installed in a directory called jdk- 10 . interim.update.patch in the current directory.
Installing the 64-Bit JDK on RPM-Based Linux Platforms
You can install the JDK on 64-bit RPM-based Linux platforms, such as Red Hat and SuSE, by using an RPM binary file ( .rpm ) in the system location.
- Download the file, jdk- 10 . interim.update.patch _linux-x64_bin.rpm .
Before you download a file, you must accept the license agreement.
$ rpm -ivh jdk- 10 . interim.update.patch _linux-x64_bin.rpm
JDK 10 can coexist with earlier versions of JDK. For each version, a new directory is created, the default directory being /usr/java/jdk. interim.update.patch .
Upgrade the package using the following command:
$ rpm -Uvh jdk- 10 . interim.update.patch _linux-x64_bin.rpm
The JDK installation is integrated with the alternatives framework. After installation, the alternatives framework is updated to reflect the binaries from the recently installed JDK. Java commands such as java , javac , javadoc , and javap can be called from the command line.
Using the java -version command, users can confirm the default (recently installed) JDK version.
In addition, users can check which specific RPM package provides the .java files:
Installation of the JRE on Linux from Archive Binaries and RPM Packages
You can install the Java Runtime Environment (JRE) on a Linux platform from archive binary files or from RPM packages.
Use one of the following processes to install JRE:
From archive binaries ( .tar.gz ): This allows you to install a private version of the JRE for the current user into any location, without affecting other JRE installations. However, it may involve manual steps to get some of the features to work. See the following table for the options available for downloading and installing the JRE from archive binaries.
From RPM packages ( .tar.gz ): This allows you to perform a systemwide installation of the JRE for all users using root access. RPM-based Linux platforms are based on Red Hat and SuSE. See the following table for the options available for downloading and installing the JRE from RPM packages.
When you download and install the Java Development Kit (JDK), the associated JRE is also installed.
The following table lists the options and instructions for downloading and installing the JRE on a Linux platform.
Download File | Instructions | Architecture | Who Can Install |
---|---|---|---|
jre- 10 . interim.update.patch _linux-x64_bin.tar.gz | Installing the 64-Bit JRE 10 on Linux Platforms | 64-bit | Anyone |
jre- 10 . interim.update.patch _linux-x64_bin.rpm | Installing the 64-Bit JRE 10 on RPM-Based Linux Platforms | 64-bit | Anyone |
Installing the 64-Bit JRE 10 on Linux Platforms
You can install JRE 10 on a 64-bit Linux platform from an archive binary file ( .tar.gz ).
- Download the file, jre- 10 . interim.update.patch _linux-x64_bin.tar.gz .
Before downloading a file, you must accept the license agreement. The archive binary can be installed by anyone (not only root users) in any location that you can write to.
The .tar.gz archive file (also called a tarball) is a file that can be simultaneously uncompressed and extracted in one step.
$ tar zxvf jre- 10 . interim.update.patch _linux-x64_bin.tar.gz
The Java Development Kit files are installed in a directory called jre- 10 . interim.update.patch .
Installing the 64-Bit JRE 10 on RPM-Based Linux Platforms
You can install JRE 10 on 64-bit RPM-based Linux platforms, such as Red Hat and SuSE, using an RPM binary file ( .rpm ) in the system location.
- Download the file, jre- 10 . interim.update.patch _linux-x64_bin.rpm .
Before you download a file, you must accept the license agreement.
$ rpm -e package_name
$ rpm -ivh jre- 10 . interim.update.patch _linux-x64_bin.rpm
Upgrade a package using the following command:
Источник