How to install Java 8 on Kali Nethunter

6,446

Solution 1

Download JDK from the official website (subscription is required) or use the following command:

wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn/java/jdk/8u281-b09/89d678f2be164786b292527658ca1605/jdk-8u281-linux-x64.tar.gz?AuthParam=1614342179_659c3e77bffb9a532e2e87404c0c6647

then install it:

sudo mkdir /usr/lib/jvm
mv 'jdk-8u281-linux-x64.tar.gz?AuthParam=1614342179_659c3e77bffb9a532e2e87404c0c6647' jdk-8u281-linux-x64.tar.gz
sudo tar xvf jdk-8u281-linux-x64.tar.gz -C /usr/lib/jvm

Add java and javac to update-alternatives:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_281/bin/java" 100
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_281/bin/javac" 100

set jdk1.8 as default:

sudo update-alternatives --set java /usr/lib/jvm/jdk1.8.0_281/bin/java

Check it:

java -version

sample output:

java version "1.8.0_281"
Java(TM) SE Runtime Environment (build 1.8.0_281-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.281-b09, mixed mode)

Solution 2

Guys I managed to solve by adding this line to my sources.list:

deb http://security.debian.org/debian-security stretch/updates main and then I ran this command:

apt-update

And then this:

apt install openjdk-8-jdk

And finally this:

sudo update-alternatives --config java

Then just choose Java 8 and that's it, Java is running :)

Share:
6,446

Related videos on Youtube

Dakota
Author by

Dakota

Sobre mim: Sou uma programadora Front-End 🎭 iniciando em Back-End 📄📝📃📂📁📈, conhecimentos em HTML 5, CSS, JAVASCRIPT, NODE JS E PYTHON (BÁSICO) :) Hobbies 💻 Programação 📚 Livros 📺 Séries 📝 Stack Overflow

Updated on September 18, 2022

Comments

  • Dakota
    Dakota over 1 year

    Guys I need to install jdk 8 for my programs to work better, many programs do not support the version higher than Java 8 so I want to install Java 8 to run better, I tried to install via apt-get, but I saw that it was removed from the Kali repository because very old. Can anyone help me how to install? When I run the command uname -m it shows me that the architecture is aarch64 can someone tell me how to install Java 8 on Nethunter for aarch64? Thanks in advance :)

    • jsotola
      jsotola over 3 years
      what does run better mean? ... what problem are you trying to solve?
    • ajgringo619
      ajgringo619 over 3 years
      It should be available in the repos. What does apt search openjdk-8 return?
    • Dakota
      Dakota over 3 years
      @ajgringo619 Sorting... Done Full Text Search... Done libreoffice/kali-rolling,unknown 1:7.0.4-3 arm64 office productivity suite (metapackage) nvidia-openjdk-8-jre/kali-rolling,unknown 9.+8u272-b10-0+deb9u1~11.2.0-2 amd64 Obsolete OpenJDK Java runtime, for NVIDIA applications
  • GAD3R
    GAD3R over 3 years
    Adding Debian without a pin priority is discouraged.