Openjdk linux что это

What is OpenJDK?

I talk to many people about how they use Java, and I find there is a high level of misunderstanding about what OpenJDK is. The idea of this post is to provide a clear description of what OpenJDK is and isn’t.

Let’s start with some history. Back in 2006, the management of Sun Microsystems (the original developer of Java) decided to make the source code of the Sun implementation of the Java platform available under an open-source license. This decision had been influenced by several factors, not least of which many Java users had been asking for it. The Apache Harmony project had started a year or so earlier with the express goal of providing an open-source implementation of Java. Sun management felt that it would be better for their implementation to be the canonical source.

The initial announcement was made at the JavaOne conference in 2006. Later that year, most of the HotSpot virtual machine and compiler code was released under the GNU Public License (GPL) with classpath exception.

As a side note, it’s also worth mentioning that the JVM included in all OpenJDK Java versions is HotSpot. People occasionally think that HotSpot is synonymous with the Oracle JDK. Whilst the Oracle JDK does indeed include the HotSpot VM; this is only because it is part of OpenJDK. All unmodified builds of OpenJDK, therefore, use the HotSpot VM.

On May 8 th , 2007, the bulk of the code for the JDK class libraries was released (under the same license), and the OpenJDK project came into existence. There remained several closed-source pieces that Sun did not have the rights to, but these were gradually replaced. With the release of build 53 of OpenJDK 7, it was finally possible to build the entire JDK from open-source code.

Understanding OpenJDK

If you look at the web page, the description is pretty unambiguous:

The place to collaborate on an open-source implementation of the Java Platform, Standard Edition, and related projects.

Donald Smith (Senior Director of Java Product Management at Oracle) is very clear about this, “OpenJDK is a place, not a thing“. This is quite true; however, we can also think of OpenJDK in terms of the OpenJDK projects (which are things). As you would expect from the definition, OpenJDK is organised into a set of distinct projects. At the time of writing, there were 73 projects. These encompass a wide variety of activities related to Java SE:

  • From JDK 6 to JDK 9, each version of Java is a separate project. Updates to JDK 7 and 8 also have projects independent from the initial implementation. However, with the switch to the six-month release cadence, all versions from JDK 10 onwards are covered by a single umbrella project. Updates, likewise, are now covered by a single project.
  • OpenJFX is the project for the open-source development of JavaFX. Originally part of the Oracle JDK, this was removed as of JDK 11.
  • There are several projects for more significant developments for the Java platform, such as:
    • Amber (small Java language features)
    • Loom (lightweight user-mode threads)
    • Panama (a replacement for JNI to interconnect the JVM with native code)
    • Valhalla (value types and generic specialisations)

    The most critical aspect of OpenJDK when dealing with the JDK is that it only represents source code (in the form of repositories). When I ask people which Java they are using, I will often get the response, “We use OpenJDK”. That’s fine, but it’s like answering “Linux” to the question of which operating system you use. OpenJDK provides all the source code for the Java Development Kit but, to run an application compiled into bytecodes, you need a binary distribution of the JDK. OpenJDK does not provide any pre-built binary distributions. Even though the OpenJDK project is hosted on the java.net domain, the Oracle OpenJDK JDK binaries you can download from jdk.java.net are not part of OpenJDK.

    OpenJDK is more than this, though.

    The Java platform is defined by a standard created under the Java Community Process (JCP). Each version of Java Standard Edition (SE) has a different Java Specification Request (JSR). An expert group is formed for each JSR and produces three distinct deliverables:

    1. A specification in the form of the Java Language Specification, the Java Virtual Machine Specification and javadocs for the required class libraries.
    2. A Technology Compatibility Kit (TCK) can verify that implementations of the standard conform to the specification. For Java SE, this is the Java Compatibility Kit (JCK), but almost everyone refers to it as the TCK.
    3. A Reference Implementation, which demonstrates that it is possible to implement the specification. For all releases since Java SE 7, this has been the corresponding OpenJDK project.

    Whilst the reference implementation of each Java version is part of OpenJDK; it is still essential that any distribution built from OpenJDK code is verified with and passes all the tests of the TCK. Even apparently minor things, like the version of a compiler being used or the command-line flags to that compiler, could, potentially, cause the resulting binaries to fail one or more tests. On the other hand, a TCK tested OpenJDK binary provides you with a high level of confidence (since no test suite can be completely exhaustive) of compatibility with another TCK-tested distribution.

    What is not part of OpenJDK?

    If you look at the Oracle JDK prior to Java 11, you will find some components that are missing from OpenJDK. The most obvious of these are the Applet Browser Plugin, Java Web Start and JavaFX. In the case of JavaFX, as already mentioned, this is a separate OpenJDK project, OpenJFX. The other parts remain closed-source.

    In the same way that you can choose different Linux distributions (Ubuntu, Debian, Red Hat, etc.), there are plenty of choices of OpenJDK binary distribution. We here at Azul provide our Zulu builds of OpenJDK, both for free and commercially supported in the form of Azul Platform Core. Almost all builds are TCK tested; the exception is OpenJDK 6 (since the TCK is no longer available).

    Decisions about how the Java platform evolves has changed over the lifetime of the OpenJDK.

    Although the specification of what is in each release of Java SE is still published through a JSR, the Java SE Expert Group no longer decides what to add or remove. Instead, this is now handled through OpenJDK using JDK Enhancement Proposals (JEPs). JEPS collect, review, sort, and evaluate proposals for enhancements to the JDK. The formal description of the JEP mechanics is described in JEP 1. The goal of JEPs is to provide a roadmap of potential new JDK features that lasts for at least three years. However, there is no intention that all JEPs submitted will end up in the JDK at some point.

    In summary, then, OpenJDK is many things. At its core, it delivers the source code used to provide users with a wide choice of distributions on which to run their applications. It also provides an open and inclusive way to define the future of the Java platform.

    Do you want to use OpenJDK to run your Java workload? Then why not try Zulu? It’s free.

    Источник

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

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

    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-программы в Ubuntu (Linux Mint), то устанавливайте OpenJDK JRE.

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

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

    Узнать версию Java в Linux

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

    Установка OpenJDK

    Установка OpenJDK JRE

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

    sudo apt install default-jre

    Установка OpenJDK JDK

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

    sudo apt install default-jdk

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

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

    sudo apt install openjdk-11-jdk sudo apt install openjdk-11-jre sudo apt install openjdk-8-jdk sudo apt install openjdk-8-jre

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

    Установка Oracle JDK

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

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

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

    sudo add-apt-repository ppa:linuxuprising/java sudo apt update

    Добавление PPA репозитория с Oracle JDK

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

    sudo apt install oracle-java12-installer

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

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

    sudo apt install oracle-java11-installer

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

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

    sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt install oracle-java8-installer

    Как удалить Java

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

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

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

    sudo apt purge oracle-java*

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

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

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

    Заключение

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

    Источник

    Читайте также:  Virtualbox destination host unreachable linux
Оцените статью
Adblock
detector