Меню Рубрики

How to install java on linux mint

How to Install Java on Linux Mint 19

Install Java on Linux Mint 19

Java is the popular programming language owned by Oracle. Java is used to build cross-platform applications. Over 3 billion devices run on Java. In this tutorial, we are going to install Java on Linux Mint 19 using different methods.

Java has the following three editions:

  1. Standard Edition(SE).
  2. Micro Edition(ME).
  3. Enterprize Edition(EE).

Following two implementations available for Java:

There is no more difference in Oracle Java and OpenJDK Java as Oracle Java provides some additional enterprise features.

Prerequisites

Before you start to install Java on Linux Mint 19. You must have the non-root user account on your system with sudo privileges.

1. Install Default OpenJDK

Currently, OpenJDK 10 is the default version for Linux Mint 19. To install OpenJDK 10 run following commands.

Update the package manager index typing following command.

Enter the following command to install Default OpenJDK on Linux Mint 19.

Confirm the installation and check the version typing following command.

The output should be:

2. Install OpenJDK 8, 10, or 11

You can install the specific version of OpenJDK by using the following command. Replacing [VERSION_NUMBER] with the version number you want to install.

For example, if you want to install OpenJDK 8 which is the current LTS version of OpenJDK then just run following command.

3. Install Oracle Java With apt

Oracle Java which is the official version from Oracle can be installed from the webupd8team repository. You will need to add the webupd8team repository to the sources list running following command.

Now update the package manager index and install Oracle with the following command.

You will be prompted to accept license terms select YES to continue.

install java on Linux Mint 19 – accept terms

After accepting the license it will download Oracle JDK and install it on your system.

4. Install Java From Oracle Website on Linux Mint 19

As the web8team repository only contains Java 8. If you want to install Java 10 then download the package from Oracle Official Website. Here we are going to install Java 10 while you can choose another version.

Download Oracle Java 10 using the following command.

Create a new directory for java installation.

Now extract downloaded Java file inside the recently created directory.

Now run the following command to create alternatives. it will create symbolic links for default commands.

5. Setting up default Java Version on Linux Mint 19

If you have installed multiple versions of Java on your system then you can change the default version running following command.

Check Current Java Version running following command.

Now to change the default Java version run the following command.

The output should be:

NOTE: to change the version just enter the number in the selection column

install java – set default java version

6. Set the JAVA_HOME Environment Variable

To set the JAVA_HOME environment variable run following command and copy the path you want to be set as JAVA_HOME.

Run the following command to set the JAVA_HOME variable.

Add the following line to the end of file

Exit by using Ctrl+x then pressing y:

install java – edit environment file

Apply the changes by running the following command.

Now verify JAVA_HOME path typing:

install java – echo JAVA HOME path

Conclusion

You have successfully learned how to install Java on Linux Mint 19. If you have any queries regarding this then please don’t forget to comment below.

Источник

Установка Java в Ubuntu и Linux Mint

Что такое Java

Java — это язык программирования, разработанный компанией Sun Microsystems, которую потом купила компания Oracle.

Программы, написанные на Java обычно работают в различных операционных системах, то есть являются кроссплатформенными. Для запуска таких программ необходимо наличие в системе Виртуальной машины Java (Java Virtual Machine — JVM), то есть, проще говоря, наличие некоторых дополнительных компонентов, которые обеспечивают возможность запуска Java-программ в системе.

Обычно, когда говорят о том, что в Linux нужно установить Java, то имеют ввиду, что нужно установить Виртуальную машину Java, чтобы получить возможность запускать программы, написанные на Java.

Какие версии Java бывают и чем отличаются

Существует несколько реализаций Java для Linux. Самыми популярными являются OpenJDK и Oracle Java. В Linux обычно пользователь устанавливает одну из этих реализаций.

  • Oracle Java — реализация Java для Linux от компании Oracle. В ней содержатся некоторые закрытые (проприетарные) компоненты и компоненты, которые защищены патентами.
  • OpenJDK — реализация Java для Linux с открытым исходным кодом.

Обе версии вполне работоспособны и в Linux можно использовать любую из них. Но иногда, для некоторых приложений, рекомендуется использовать Oracle Java.

В Linux пакеты с Java представлены в двух редакциях:

  • JRE — Java Runtime Environment — компоненты, предназначенные для запуска Java-программ в Linux.
  • JDK — Java Development Kit — компоненты, предназначенные для запуска, компиляции и разработки Java-программ.

Какую версию устанавливать

Рядовому пользователю, которому нужно просто запускать Java-программы, обычно достаточно установить «OpenJDK JRE».

Если потребуется компиляция Java-программ, то нужно будет установить «OpenJDK JDK».

Рассмотрим, как установить Java в Ubuntu Linux. Абсолютно аналогично выполняется установка в Linux Mint и других дистрибутивах, основанных на Ubuntu.

Проверка версии Java

Чтобы проверить, установлена ли у вас уже в системе какая-либо версия Java, выполните в терминале команду:

Если Java установлена, то вы получите информацию о том, какие компоненты Java установлены в системе.

Установка OpenJDK

Установка OpenJDK JRE

Для установки OpenJDK JRE в Ubuntu Linux достаточно установить пакет default-jre. Для установки выполните в терминале команду:

Установка OpenJDK JDK

Если вы хотите установить OpenJDK JDK, то нужно установить пакет default-jdk (он также установит default-jre). Для установки выполните команду:

Установка OpenJDK определенной версии

Если вам нужно установить конкретную версию, то выполните одну из следующих команд. В репозиториях Ubuntu сейчас представлены OpenJDK версий 11 и 8.

После установки, можно проверить, какие компоненты Java установлены, выполнив команду:

Установка Oracle JDK

Установка Oracle JDK свежей версии

Свежую версию Oracle JDK можно установить, используя PPA-репозиторий, подготовленный проектом linuxuprising.

Сначала добавим PPA-репозиторий. Выполняем следующие команды. При выполнении первой команды появится информационное сообщение, нажмите Enter для продолжения.

Теперь выполним установку Oracle Java версии 12:

Во время установки нужно будет ознакомиться и принять лицензию:

Для установки Oracle Java версии 11 используйте команду:

Установка Oracle JDK старой версии

Если вам нужно установить Oracle JDK старой версии 8, то вы можете воспользоваться PPA-репозиторием, который подготовлен проектом webupd8. Для установки выполните в терминале следующие команды. При выполнении первой команды появится информационное сообщение, нажмите Enter для продолжения.

Как удалить Java

Если у вас установлены пакеты OpenJDK, то для их удаления используйте команду:

Или следующую команду, если требуется также удалить файлы конфигурации (полное удаление OpenJDK):

Для удаления Oracle Java используется команда:

Запуск Java-программ

Если Java установлена в Ubuntu Linux, то для запуска Java-программ обычно достаточно дважды щелкнуть по файлу программы. Он может иметь расширение .jar .

Для запуска .jar файлов из командной строки, выполните команду:

Заключение

Мы рассмотрели, какие версии Java бывают для Linux. Рассмотрели, как установить версию OpenJDK, а также версию Java от Oracle. Обычно начинающий пользователь вообще не понимает, что именно ему нужно установить. Поэтому краткое резюме: Если вам нужно просто запустить какую-нибудь Java-программу в Ubuntu Linux (Linux Mint и других подобных дистрибутивах), то устанавливайте OpenJDK JRE.

Источник

How To Install Java on Linux Mint / Ubuntu

October 14, 2015 Author: Angelos Kyritsis 4

Some distributions, such as Linux Mint, have OpenJDK installed right out of the box. For Ubuntu Linux, however, if we are to run applications programmed in Java, we need to install Java. In this guide, we will install Java on Ubuntu using both OpenJDK, and the official OracleJDK.

Unblock any international website, browse anonymously, and download movies and Mp3 with complete safety with CyberGhost, just for $2.75 per month:

We have prepared this guide on Ubuntu Linux 15.04 and Linux Mint 17.2. It should work to install Java in recent earlier and future versions. It might also work for Linux distributions based on Ubuntu/Debian.

What’s the difference between OpenJDK and OracleJDK?

There are two options to install Java on Linux: The open-source OpenJDK and the official OracleJDK.

Is there a difference between the two? Which one should we pick, and why?

The fact is, there are no huge differences between OracleJDK and OpenJDK, they are very close.

As answered on the Official Oracle Blog, the build process of OracleJDK builds on OpenJDK by adding just a couple of pieces, which include the deployment code and some closed source third-party components. It works similarly to Chromium and Google Chrome.

For most Java applications, OpenJDK is good enough. After all, it is maintained by Oracle engineers, so it is in no way an «inferior» type of Java. If we don’t need the third-party components of OracleJDK, like JRockit Mission Control, OpenJDK is perfectly adequate.

If OpenJDK doesn’t work with a Java application, we should install OracleJDK.

Do we already have Java installed?

If we are using a distribution based on Ubuntu, it might already have OpenJDK installed, like Linux Mint does.

To check that, we just need to open a terminal with Ctrl+Alt+T and type:

If Java is already installed, we will get the current version.

If it isn’t, on some distributions we will get a list of packages that include Java.

How to install Java in Ubuntu with openJDK

To install Java with OpenJDK on Ubuntu, we open a terminal and type:

This command will install the Java Runtime Environment (JRE) and should be enough for most users.

If you are new to Linux, remember that when we are asked to enter our Password on the terminal, for the sudo command, nothing will appear as we are typing, no stars or dots or anything. We just type our password and press Enter.

The current version of Java, as of this writing, is version 8, that is why we are are using openjdk-8-jre.

When Java reaches version 9, which is expected on September 22, 2016, the same command will work with openjdk-9-jre.

After we install Java, the «java -version» command will return the proper version.

Install Java to compile

To compile Java applications, we need to install the Java Development Kit (JDK).

This is essential if we are writing code in Java or want to use certain applications such as Apache Ant, Apache Maven, Eclipse, IntelliJ IDEA, etc.

The command for the Java Development Kit is:

After September 22, 2016, we can replace the command with openjdk-9-jdk to get the Java 9 Development Kit.

How to install Java in Linux Mint or Ubuntu with OracleJDK

To install Java using the OracleJDK, we first need to install Python Software Properties, with:

Then, we add the special java repository that is maintained by the Webupd8 team.

Any time we add a repository, we then have to do an update, so the new packages are available for installation.

Finally, we install Java with:

The installation will ask us to read the Java license at http://java.com/license.

We must agree with the Oracle Binary Code license terms, or the installation won’t proceed.

The rest of the installation is automatic. The installer will download 173MB.

. and complete the installation.

How to set the «JAVA_HOME» environment variable

Some applications need to know the path where Java is installed, using the JAVA_HOME environment variable, which is not automatically created when we install Java.

To create this variable, we will first need to find the path of installation with the command:

If we installed the OpenJDK, it will probably be
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

For the OracleJDK it will probably be
/usr/lib/jvm/java-8-oracle/jre/bin/java

We can copy the path by selecting it with the mouse and right-click -> copy, or pressing Ctrl+Shift+C (the plain Ctrl+C won’t work on the Linux Terminal).

Then, we open the file /etc/environment with gedit:

Don’t worry about the IBUS-WARNING, it shows every time we run gedit through the terminal as root.

At the end of the file, we add the following line, containing our Java installation path we just copied:

We save the file and close gedit. Then, we reload the environment file, with:

To test if everything went well, we run:

This should show our Java installation path.

Remember, the Linux terminal is case sensitive, java_home or Java_Home won’t work.

Did you have any trouble to install Java on Linux Mint or Ubuntu?

If anything on this guide didn’t work for you as described, and you couldn’t install Java on Linux Mint or Ubuntu, leave us a comment.

Support PCsteps

Do you want to support PCsteps, so we can post high quality articles throughout the week?

You can like our Facebook page, share this post with your friends, and select our affiliate links for your purchases on Amazon.com or Newegg.

If you prefer your purchases from China, we are affiliated with the largest international e-shops:

  • GearBest
  • Banggood
  • Geekbuying

About Angelos Kyritsis

Angelos Kyritsis is the Editor-In-Chief of PCsteps.gr, which is the #1 Computer Hardware site in Greece.

He loves good beer, having more RAM on his PC that he will ever, ever need, and writing for a living.

He has also published a novel, but it would be, quite literally, all Greek to you.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

  • Mac os hosts file
  • Mac os host редактировать
  • Mac os high sierra установка сторонних приложений
  • Mac os high sierra установка с нуля
  • Mac os high sierra список устройств