Thursday , May 6 2021
Installing & Configuring Latest Oracle Java with Kali (Currently 2021.1) java logo 1

Installing & Configuring Latest Oracle Java with Kali (Currently 2021.1)

Creating this post to keep track of how I successfully installed and configured Oracle Java JDK (current latest version: 16.01) on my Kali Linux distribution (current latest version: 2021.1).

https://www.oracle.com/java/technologies/javase-downloads.html

Java JDK Download official URL

Prerequisite: Install GDEBI, Not necessary though. But I usually install applications with gdebi:

# sudo apt-get install gdebi

Purge OpenJDK

# sudo apt-get purge openjdk-\*

Install Oracle JDK

# gdebi jdk-16.0.1_linux-x64_bin.deb

Installation Complete.

Configure Oracle Java as default:Tell the system that there’s a new Java version available:

Tell the system that there’s a new Java version available:

# sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_version/bin/java" 1

In my case:

# sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk-16.0.1/bin/java" 1

Note: If updating from a previous version that was removed manually, execute the above command twice, because you’ll get an error message the first time.

Set the new Oracle JDK as the default:

# sudo update-alternatives --set java /usr/lib/jvm/jdk-16.0.1/bin/java

Verify the version of the JRE or JDK:

# java -version
java version "1.8.0_241"
Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)

Set .JAR files to Open with JAVA with a Double-Click

Adding a file called /usr/share/applications/java.desktop with following content will do the trick.

First Create & Open the java.desktop file:

# nano /usr/share/applications/java.desktop

Add following content in this file and SAVE:

[Desktop Entry]
Name=Java
Comment=Java
GenericName=Java
Keywords=java
Exec=java -jar %f
Terminal=false
X-MultipleArgs=false
Type=Application
MimeType=application/x-java-archive
StartupNotify=true

After adding this file you should be able to find an entry called Java in the Open file with… Dialog

Resources:

This post is based on content from below pages:

https://askubuntu.com/questions/192914/how-run-a-jar-file-with-a-double-click
https://docs.datastax.com/en/jdk-install/doc/jdk-install/installOracleJdkDeb.html

About Muhammad Attique

Check these out :)

How to Install & Configure Google Chrome on Kali Linux

In this blog post, I’m going to demonstrate step by step how to install & …

Leave a Reply

Your email address will not be published. Required fields are marked *

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

I agree to these terms.