Java is one of the most popular programming languages out there. But not only that, it also consists of a software platform highly popular among developers. Besides this, it is a very robust language that tolerates errors in real time through exceptions. So many companies rely on Java to deploy their highly reliable software. Java is also needed to run not-so-strong programs on the desktop and on the desktop the most popular distribution is Ubuntu. So, in this post, we will teach you how to install Java on Ubuntu 19.04.
Install Java on Ubuntu 19.04 – the OpenJDK
Java belongs to Oracle so the community in function of protecting the Java source code releases it under the OpenJDK project. Thus we can have the novelties without problems of licenses. This is especially useful if we are learning the language or are immersed in educational projects.
The great advantage of OpenJDK is its community support without sacrificing, some kind of Java feature. It is also much easier to install because the packages are in the official repositories of the distribution.
So, open a terminal and run one of the following commands.
For Java 11, we need to run:
:~$ sudo apt install openjdk-11-jre
However, Java 12 is available. If you want to use it, you can install t by using this command:
:~$ sudo apt install openjdk-12-jre
So this is enough.
Install Java on Ubuntu 19.04 – The Oracle Binaries
However, if we are in a company and our project needs to be commercialized on a large or medium scale, it is advisable to use Oracle binaries. So although the download is free, we need a license to monetize the project.
The great advantage of this is that we will have many more resources from Oracle. However, one of the restrictions of the commercial version is that we will not be able to use the programs for data processing or for any commercial, production or internal commercial purpose other than development, testing, prototyping, and demonstration of the application. We also may not remove or modify any program mark or any Oracle copyright notice. So keep this in mind when choosing the version for your project.
So, to install Java on Ubuntu 19.04, We will use a PPA.
:~$ sudo add-apt-repository ppa:linuxuprising/java :~$ sudo apt-get update
To install Oracle Java 11 on Ubuntu 19.04:
:~$ sudo apt install oracle-java11-installer
Or, to install Oracle Java 12:
:~$ :~$ sudo apt install oracle-java12-installer
And that is it.
Conclusion
Java is a basic programming language used today, so you will probably have to use it at some point. So, now that you know how to install Java on Ubuntu 19.04 you won’t have any problems to start using it.
Please share this post with your friends.
I believe you may have made a mistake with the commands to install OpenJDK. The correct OpenJDK package names are ‘openjdk-11-jre’ and ‘openjdk-12-jre’ for versions 11 and 12, respectively.
You are right. Thanks.