Skip to main content

How To manually Install Oracle Java 12 on Debian 9



Java and the JVM (Java's virtual machine) are required for many kinds of software, including Tomcat, Jetty, Glassfish, Cassandra, Jenkins, Gradle, ELK Stack, Graylog and  Eclipse IDE
Java Development Kit (JDK) is a package of tools for developing Java-based software, whereas the JRE is a package of tools for running Java code.The JRE can be used as a standalone component to simply run Java programs, but it's also part of the JDK. The JDK requires a JRE because running Java programs is part of developing them.

This post is designed to guide you through the manually installation process, of the Java Developer Kit (JDK) using binary formats. While this post will focus on  version 12.0.1  You can still select the version you wish to use for your projects and still be able to use the procedure's detailed here as long as the version that you chose is in binary format. When you finish, you'll be able to use the JDK to develop software or use the Java Runtime to run software.

Prerequisites

A non-root user with sudo access

Installing the JDK

I will use the command line to download the JDK,  but if you have access to browser you can use that for simplicity.

If your installing form the command line, use the following command

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.1+12/69cfe15208a647278a19ef0990eea691/jdk-12.0.1_linux-x64_bin.tar.gz

Extract the downloaded JDK archive to the desired directory e.g /usr/

tar -zxvf jdk-12.0.1_linux-x64_bin.tar.gz

sudo mv jdk-12.0.1 /usr/

Install Oracle Java

Once you have moved java to the location you want, then you must run update-alternatives commands to install the Java on your system.

 sudo update-alternatives --install /usr/bin/java java /usr/jdk-12.0.1/bin/java 1
  update-alternatives: using /usr/jdk-12.0.1/bin/java to provide /usr/bin/java (java) in auto mode


Verify Java Installation

We have successfully installed Oracle Java on our Debian system. Let’s use the following command to verify the installed version of Java on our system.

java -version
java version "12.0.1" 2019-04-16
Java(TM) SE Runtime Environment (build 12.0.1+12)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)


javac -version
-bash: javac: command not found


Setup Environmental Variable

 Many programs written using Java use JAVA_HOME, JRE_HOME, etc. environmental variables So, we need to set the environmental variables like below.

export PATH=$PATH:/usr/jdk-12.0.1/bin
export JAVA_HOME=/usr/jdk-12.0.1
export J2SDKDIR=/usr/jdk-12.0.1


javac -version
javac 12.0.1

Note:
Multiple JDK versions can coexist in a system and we can change the default version as per our requirements at any time.

sudo update-alternatives --config java

Popular posts from this blog

django react app setting up the backend

On the previous article I demonstrated how we can use the generic views along with ModelSerializer classes to rapidly develop our REST APIs. Knowledge that you will need  in your career as full stack / backend developer, however think of this article as an extension to the previous one, equipped with what we already know about REST API we will step our game up and discuss about ViewSet, ModelViewset we will dig deep into the concepts of Routers which allow us to manage our api routes in a simple and sophisticated manner as well as helping to speed up building APIs even further. There for on part II of this article i'll work you through on how React application can consume this RESTful API. There for at the end of the day we will have a full stack web app, in short we strat our development at the backend then later on we move at the frontend... so are you excited and ready to take the challange? lets do this then..... you can get source code for the bakend on github Preparat...

How to Install PostgreSQL on debian stretch in oder to use it with your Django application and allow remote connection

In this guide, we'll demonstrate how to install and configure PostgreSQL to use with your Django applications. We will install the necessary software, create database credentials for our application, and then start and configure a Django project to use this backend. We will start by  install the database software and the associated libraries required to interact with them. This guide assumes that you allready have a working Django project. Step 1 – Prerequsities apt-get install python3-pip python3-dev libpq-dev postgresql postgresql-contrib Step 2 – Connect to PostgreSQL After installing the PostgreSQL database server by default, it creates a user ‘postgres’ with role ‘postgres’. It also creates a system account with the same name ‘postgres’. So to connect to postgres server, login to your system as user postgres and connect database. su - postgres You should now be in a shell session for the postgres user. Log into a Postgres session by typing:...

How to create REST API using Django REST Framework

This post begins with already working project and app's, I found that there some few requirement's that my project needed to handle and the best option for those requirement's was to use the Django's  Rest Framework. The way that I will tackle this task is more specific to the needs of the project rather than a one to one how to..., that being said you can still follow along, the approach that I'm going to use is easy to follow since I'll be providing a lot of information a log the way for better understanding of the why and how.....this code is available on Github , enough with the alerts and on with the show. Note:  If you would want to mimic the exactly settings then you will need to enable user authentication on your project you can follow this link for details .  Start with the DRF (Django Rest Framework) installation pip3 install djangorestframework For our app to use DRF, we'll have to add rest_framework into our settings.py.   nan...