In this New Entry about how "Learn how to install Oracle Java" now in your version 10. We will verify and update the necessary terminal commands that allow us manually or design a Bash Shell script that I automated the tedious task of installing the JDK and JRE.
Let's remember that both the OpenJDK and the add-on for browsers called IcedTea are easy to install. and most of the times it covers all our expectations of development and online execution of applications based on the Oracle product, but sometimes the original support provided by Oracle is better, so it never hurts to know how to install it from scratch when the OpenJDK y Iced Tea it does not satisfy our requirements for Java support in our Free Operating System.
OpenJDK + IcedTea
Currently these free Oracle Java substitute plugins can be easily installed from the console and depending on the version of the Branch (Distro) and Version of your Free Operating System, as follows:
aptitude install default-jdk
aptitude install openjdk-7-jdk
aptitude install openjdk-7-jre
aptitude install openjdk-8-jdk
aptitude install openjdk-8-jre
aptitude install openjdk-9-jdk
aptitude install openjdk-9-jre
aptitude install icedtea-netx
aptitude install icedtea-plugin
OracleJava
Using the JDK - JRE support (original and proprietary) can offer us in most cases greater compatibility, support and new functions than that given by OpenJDK and IcedTea.
When our work options with these applications available in free format are exceeded, and taking into account that in general, they are not found in our distribution or repository emulating the latest version of the JDK, it is preferable then to do it manually or through a Script of Bash Shell said installation, which is something very practical.
Therefore, using the Java Development Kit (Oracle JDK) which is the official Development Kit for the Java programming language, an object-oriented development environment, is very useful and necessary.
And why install Java JDK?
Remembering previous posts on JDK inside and outside this blog we can synthesize about JDK that this software or application allows us to write Java applets and applications inside or outside of an Internet browser.
The JDK also includes the Java Runtime Environment (JRE), the Java Compiler, and the Java APIs. Which is very useful for new and experienced programmers.
JDK is not that necessary most of the time for a normal or basic User, sometimes just for simple things like an Embedded Console Online Game.
On the other hand, for advanced or administrative users it is applied many times for things like electronic certifications, because its buttons are applets.
Therefore, many times it is essential to have it installed if you do not want to miss a good part of the web. That is, although there are many web pages that contain small portions of JDK (buttons, menus) or that are even designed entirely in JDK.
Therefore, Java JDK cannot be missing from your Web Browser and Operating System in general!
Previous steps
Before installing the JDK via commands, you have to download it from the Oracle website, so you can go to it using the internet search engine of your choice or the following link: Oracle - JDK 10
After downloaded, it may or may not be unzipped and copied from the user's graphical environment to where necessary, but we will also execute these steps from the console.
Command commands
The command commands that are written below could be executed manually or within a Bash Shell Script for automation:
sudo -s
tar -zxvf Descargas/jdk-10.0.1_linux-x64_bin.tar.gz -C /usr/lib/jvm/
echo "JAVA_HOME=/usr/lib/jvm/$VERSION" >> /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-10.0.1/bin/java 1
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-10.0.1/bin/javac 1
update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk-10.0.1/bin/javaws 1
update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-10.0.1/bin/jar 1
update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /usr/lib/jvm/jdk-10.0.1/lib/libnpjp2.so 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 javaws /usr/lib/jvm/jdk-10.0.1/bin/javaws
update-alternatives --set jar /usr/lib/jvm/jdk-10.0.1/bin/jar
update-alternatives --set mozilla-javaplugin.so /usr/lib/jvm/jdk-10.0.1/lib/libnpjp2.so
cd /usr/lib/mozilla/plugins/
rm -f libnpjp2.so
ln -s /usr/lib/jvm/jdk-10.0.1/jre/lib/libnpjp2.so
. /etc/profile
CHECKOUT
You can check that you have indeed installed the Oracle Java 10 (JDK - JRE) both by console and by browser, using the official Oracle Java version checker: test applet
By console
Use the following commands:
java -version
javac -version
By Browser
Run a version of Firefox 51 or earlier, or any other Web Browser that supports Java, since the most common ones like and updated like Firefox 52+, Opera Browser and Google Chrome, are disabled by default so as not to run the JRE.
By Operating System
Run or install an Application that is native to Java or requires JDK / JRE support installed to check the correct installation of it.
Depending on how advanced each is using Shell Scripting, these commands can allow you to create an .sh file to automatically perform these steps. And you can even program in it to download the latest version of Java indicating via terminal which is the latest version released.
Automating these steps in a Bash Shell Script can make your downloaded Java JDE all functional in less than 30 seconds. After this, you can install any application in the Operating System that requires JDK support and run any webapps that requires it in a browser based on Mozilla Firefox less than version 51 or optimized for the JRE add-on.
Remember, the idea is to understand how each line by line, command by command, variable by variable works, to understand and learn Shell Scripting. So with this new post I leave you with an exciting new research assignment.
If you want to brush up on Shell Scripting can revisit these internal publications: Shell Scripting DesdeLinux
And if you want to learn a little more about the topic touched You can visit the official Java publication on the installation at this link: Standard Edition Installation Guide or watch the video below:
How is the installation in Arch?
I have not handled Arch before but I imagine that the procedure must be very similar!
I have used both options and I have done better with openjdk than with java, it is better integrated with the system and I have not had compatibility problems.
Yes, well it is very possible, many times everything depends on many things: Operating System, OpenJDK or Java JDK version and sometimes it may even depend on the HW.
It already came to us, Java 18