Have Java installed on Ubuntu (easy steps i followed

Table of contents

No heading

No headings in the article.

Today i was working on integrating keycloak into my springboot-react project. I had to use some docker since there was need to pull the keycloak container from dockerhub.

So i used docker run -p 8080:8080 -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:19.0.1 start-dev to try to pull the run the image at quay.io/keycloak which i did but the application does not start on my localhost. I realised later that i needed to upgrade my java version from 8 to about 17.

Java is a general-purpose, class-based, object-oriented multipurpose programming language that is popular due to the design of having lesser implementation dependencies, meaning that the compiled Java code can be run on all platforms that support Java without the need for recompilation. Java is also fast, secure, and reliable, therefore. It is widely used for developing Java applications in laptops, data centers, game consoles, scientific supercomputers, cell phones, etc.

JDK 17 (JDK 17) has brought forward new language enhancements, updates to the libraries, support for new Apple computers, removals and deprecations of legacy features, and work to ensure Java code written today will continue working without change in future JDK versions.

It is on that background that i decided to take note of the steps that i followed to do that. So i will be upgrading version 17 as shown below;

  • First of all i am going update my Ubuntu operating system to make sure all existing packages are up to date: sudo apt update && sudo apt upgrade -y.
  • The first option will be to install Java 17 JDK from the ppa:linuxuprisingrepository. Currently, Java 17 is featured in this PPA. This is a non-official repository. Note: Any PPA usage should be with caution and at your own risk. Otherwise i will run sudo add-apt-repository ppa:linuxuprising/java -y in my terminal.

  • I will then update my APT Repository: sudo apt update

  • In order to install using the APT package manager, i will execute the following command: sudo apt-get install oracle-java17-installer oracle-java17-set-default.

  • And the last step is to accept Oracle’s terms during the installation. and check java -version which should bring the output below;

Screenshot from 2022-08-16 10-22-42.png