Category Archives: JAVA

How to create and run Java Program in Eclipse IDE ?

Eclipse is one of the most popular IDE for Java Programming. We can easily write, compile and run our Java program with Eclipse. However, today I will show you, how you can run Java program with Eclipse IDE.

How to install Oracle JAVA in Kali Linux ?

Java Installing _ NTK

Java is a general-purpose computer-programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible. To run Java programs on our Kali Linux machine we will need to have the JDK (Java Development Kit). We can install Oracle Java in our Kali Linux with various ways. But today we will learn a simple way to install and use Oracle Java.

First you need to download the latest version (or your desire version) of Java from Oracle official website.
Download link : https://www.oracle.com/technetwork/java/javase/downloads/index.html

Go to the link and choose your Java JDK version and download the .tar.gz file for Linux 86/64.

For me I have downloaded JDK 8u191 for my 64 Bit Kali Linux. After completing download, go to your download directory and extract the .tar.gz file to your desire location (for me its /opt/). You can extract .tar.gz file by using GUI or you can use command for that.
For GUI, just select the .tar.gz file and click right button your mouse, then choose Extract To.. option and specify your desire directory.

You can extract .tar.gz file by using below command

tar xvzf jdk-8u191-linux-x64.tar.gz -C /opt/

You can replace /opt/ with your desire directory/path.

Now, we need to registers the downloaded version of Java as an alternative, and switches it to be used as the default. For this run below commands one by one

update-alternatives –install /usr/bin/java java /opt/jdk1.8.0_191/bin/java 1
update-alternatives –install /usr/bin/javac javac /opt/jdk1.8.0_191/bin/javac 1
update-alternatives –set java /opt/jdk1.8.0_191/bin/java
update-alternatives –set javac /opt/jdk1.8.0_191/bin/javac

You need to replace /opt/jdk1.8.0_191/ with your Java Installation path where you extracted the .tar.gz file.

Now check your Java version by using below command

java -version

You can also follow this instruction to install Oracle Java on other Debian based Linux distros like Ubuntu, Mint etc.