A few days ago (22/03), the organization Oracle announced the availability of "Java 18". The latest version of one of the most used programming languages and the world's number one development platform. The new package or program, also known as Oracle JDK 18, offers thousands of improvements in terms of performance, stability and security. And in addition, including nine platform improvement proposals, thus further boosting developer productivity.
However, in this publication we will not delve into its novelties or improvements, since we did that a few days after (28/03) its launch. Here, we will delve into more practical and technical aspects, that is, about his installation and configuration about the current GNU / Linux distribution de Debian stable.
And as usual, before entering fully into today's topic on the installation and configuration of the latest available version of the Java JDK, that is, the version Java 18, Also known as Oracle JDK 18, we will leave for those interested the following links to some previous related publications. In such a way that they can easily explore them, if necessary, after finishing reading this publication:
"This new version of Java SE 18 arrives with the exception of the removal of some deprecated features, maintains compatibility with previous versions of the Java platform, and most previously written Java projects will continue to work unchanged when run with the new version. And its default encoding is UTF-8". The new version of Java SE 18 has already been released and these are its news
Java 18: Many performance, stability and security improvements
How to use Java 18?
Download
for downloading Java 18 (Oracle JDK 18) the following must be accessed link and download the .deb file willing to GNU / Linux distributions based on Debian stable.
Installation
Once downloaded, we proceed to its installation in the preferred way, that is, with the apt or dpkg command. In our use case, we use the following command order:
«sudo apt install ./Descargas/jdk-18_linux-x64_bin.deb»
Configuration
Once the package is installed, we still need to proceed to configure java 18, so that it is configured as default version, since currently our Operating system used (Miracles GNU / Linux), comes with Open JDK 11.
And for this, we need like admin user (root), run the following commands:
sudo -s
echo "JAVA_HOME=/usr/lib/jvm/jdk-18" >> /etc/profile
echo "PATH=$PATH:$HOME/bin:$JAVA_HOME/bin" >> /etc/profile
echo "export JAVA_HOME" >> /etc/profile
echo "export PATH" >> /etc/profile
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-18/bin/java 1
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-18/bin/javac 1
update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-10.0.1/bin/jar 1
update-alternatives --set java /usr/lib/jvm/jdk-10.0.1/bin/java
update-alternatives --set javac /usr/lib/jvm/jdk-10.0.1/bin/javac
update-alternatives --set jar /usr/lib/jvm/jdk-10.0.1/bin/jar
. /etc/profile
Verification
Once finished with this procedure, we can execute the following command orders To validate that everything went well:
java --version
javac --version
jar --version
At this point, there is nothing left to do but try some Java application or development to experience the benefits of the new installed version.
"The Microsoft OpenJDK binaries for Java 11 are based on the OpenJDK source code, following the same release scripts used by the Eclipse Adoptium project and tested by the Eclipse Adoptium QA suite (including OpenJDK project tests)". Microsoft announced the availability of the preview version of OpenJDK
Summary
In short, having Java 18 and of any previous or next version related to the original package of one of the best programming languages and the number one development platform in the world on our stable Debian Distros is not complicated at all. And in the best case, it is always advisable to use the free and open version called OpenJDK, which likewise is developed jointly with Oracle.
We hope that this publication is very useful for the entire «Comunidad de Software Libre, Código Abierto y GNU/Linux»
. And don't forget to comment on it below, and share it with others on your favorite websites, channels, groups or communities of social networks or messaging systems. Finally, visit our home page at «DesdeLinux» to explore more news, and join our official channel Telegram from DesdeLinux, West group for more information on the subject.
In any distro, the last Java you install, regardless of its version, will be the default by the system, even if you have 7 different javas installed, the last one you install, whether from Oracle or not, remains as default, you do not need to do anything to choose it.
Regards, Choripan. Thanks for your comment. Certainly, this should be the case when a version of OpenJDK or Java JDK is installed from the repositories, but in this particular case, using the .deb file from the Java website, and installing it on MX Linux, it was not so. Therefore, I had to configure it by hand, that is, it was the default version.