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

Hands on Drupal

This video features Drupal CMS and Apache Solr search server Building big engaging content delivery system      

Difference between HashMap, LinkedHashMap and TreeMap

 LinkedHashMap is an implementation of java.util.Map interface with predictable iteration order (the order of insertion) i.e. LinkedHashMap will iterate in the order in which the entries were put into the map. LinkedHashMap implementation differs from HashMap in the way that it maintains a doubly-linked list running through all of its entries. This linked list defines the iteration ordering, which is normally the order in which keys were inserted into the map. The insertion order is not affected if a key is re-inserted into the map. Performance of LinkedHashMap is slightly below than that of HashMap, due to the added expense of maintaining the linked list. The other two important implementations of Map interface are java.util.HashMap and java.util.TreeMap. They offer mostly the same functionality. The most important difference is the order in which iteration through the entries will happen. HashMap makes no guarantee about the order. The order can even change completely whe...

mongodb authentication setting

The administrator of the database is the right person for the task of granting, or denying, permissions to users for doing operations with database resources. By using roles, we can specify what action can be done with a resource. Therefore, a role is a privilege granted to a user to do specific tasks with specific resources. Before you enable access control, you should create a user that can then create users and assign roles to them once access control is enabled.This user-admin will then be used to create and maintain other users and roles, so needs to be assigned a suitable role to enable it to do so. I assume you already have admin user set up within you system if not refer hare before proceeding. The role userAdminAnyDatabase in MongoDB gives ability to create users and assign roles to them, but by itself it doesn’t allow the user to do anything else. The superuser role in MongoDB is the root . In the this post i will show how to create, show and delete a user in...