How to Install Java JDK in Kali Linux

POST UPDATED with latest version of Java: 18/12/2013.

This is a small guide with instructions that users can copy paste and make Java work in their Kali Linux. Thanks to purehate for providing original instructions. I’ve modified his instruction to suit my needs and I hope this will benefit users as well. Oracle Sun Java JDK in Kali Linux

So lets get on with this guide…

Instructions on How to Install Java JDK in Kali Linux:

Download the latest Java SE SDK version

Go to the following link and download jdk7. At the time of writing this guide the jdk version was jdk-7u45-linux-x64. Note that I’m using x64 which is 64-bit. 32-bit users should choose their versions accordingly. Not that tough really!

Following is what I’ve used.

JDK-7u45-Linux-x64

Again, at the time of writing this guide the available version was jdk-7u45-linux-x64.tar.gz

Download and save the file in /root directory.

UnTar the Archive and move to /opt

tar -xzvf /root/jdk-7u45-linux-x64.tar.gz
mv jdk1.7.0_45 /opt
cd /opt/jdk1.7.0_45

Install and register binaries

This step registers the downloaded version of Java as an alternative, and switches it to be used as the default:

update-alternatives --install /usr/bin/java java /opt/jdk1.7.0_45/bin/java 1
update-alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_45/bin/javac 1
update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.7.0_45/jre/lib/amd64/libnpjp2.so 1
update-alternatives --set java /opt/jdk1.7.0_45/bin/java
update-alternatives --set javac /opt/jdk1.7.0_45/bin/javac
update-alternatives --set mozilla-javaplugin.so /opt/jdk1.7.0_45/jre/lib/amd64/libnpjp2.so

Test

First of all, close your browser and re-open. You won’t believe how many users actually forgets to do this step and later complains Java ain’t working. I’d advise to bookmark this site to be able to reopen these instructions quickly, or simply copy these into a leafpad/vi/text file.

To check the version of Java you are now running

java -version

To check the browser plugin just click Do I have Java?

This should take you to Oracles Java website and you will see a confirmation message.

Thanks for reading.

Check Also

Enabling AMD GPU for Hashcat on Kali Linux: A Quick Guide

Enabling AMD GPU for Hashcat on Kali Linux: A Quick Guide

If you’ve encountered an issue where Hashcat initially only recognizes your CPU and not the …

How to fix You can’t access this shared folder because your organization’s security policies block unauthenticated guest access error on Windows 11

If you have the following error on Windows 11 “You can’t access this shared folder …

36 comments

  1. Thank you

  2. You're welcome Phelipe.

  3. kalilinuxnoob1987

    Thank you. Great tutorial!!! :)

  4. thank you very much

  5. i get question how about this ???
    no alternatives for mozilla
    when i check my java is 1.6 version
    please reply me …..:(

  6. what if i have a Iceweasl browser..what changes in command of mozilla??

  7. Just a quick question. Why JDK over JRE? That confused me a little.

    • Its preference I would assume, but the JDK includes jre when you install it lol

    • JDK is for developer, for those who develop java applications and it have tools for developing. Note that JDK also include JRE. I develop java software and I find that JDK is needed in my development.

      JRE on the other hand, is for the end-user who is using java application, but not developing. JRE doesn’t include JDK.h

      There is another JRE for Server. In total, there are 3 packages available. JDK, JRE & JRE Server.

      A little source to read if interested in detail : http://www.oracle.com/technetwork/java/javase/downloads/index.html

  8. Sorry, one final question. Why extract it to the root folder instead of creating a separate folder for it inside of root?

  9. I see it actually does go to it’s own folder. I retract my last question. My understanding of all the options of all the programs needs serious work.

  10. I looked the website and there is no 32-bit version?!

  11. gracias :)

  12. How can i install jre java ?
    Thanks in advance

  13. Guide needs to be updated in accordance with the latest JDK.

  14. installing jdk 1.8.0_31 but not well confiqured

  15. Dont forget :
    apt-get install icedtea-7-plugin

    This allows Java to work in your browser (if thats what you want)

  16. help error while installing: tar (child): /root/jdk-7u79-linux-x64.tar.gz: Cannot open: No such file or directory
    tar (child): Error is not recoverable: exiting now
    tar: Child returned status 2
    tar: Error is not recoverable: exiting now

  17. This still applies. Thanks!

  18. hey..i used the procedure above but when i opened gparted, i got this error
    (gpartedbin:28676): glibmm-ERROR **:
    unhandled exception (type std::exception) in signal handler:
    what: locale::facet::_S_create_c_locale name not valid

    could it have been caused by this procedure?

  19. Thank you blackmoreops for this guide, working on 2015. I even made a video tutorial on this giving credit to blackmoreops himself. Feel free to watch, and thanks again to blackmoreops, really useful guide for me.

    • i got this error after
      update-alternatives –install /usr/bin/java java /opt/jdk1.8.0_73 bin/java 1
      update-alternatives: priority must be an integer

  20. I get this error when entering the alternative
    root@kali:/opt/jdk1.8.0_60# update-alternatives –install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.8.0_60/jre/lib/amd64/libnpjp2.so 1
    update-alternatives: error: alternative path /opt/jdk1.8.0_60/jre/lib/amd64/libnpjp2.so doesn’t exist

  21. what about Kali Sana ? , as it seems not to be working .
    altought the version terminal shows is
    “java version “1.7.0_79″
    OpenJDK Runtime Environment (IcedTea 2.5.6) (7u79-2.5.6-1~deb8u1)
    OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode) ”

    but i dont get any Java in the list of execute the java file from it , where i am going wrong ?

  22. helpful .. useful and it works … thx for help u save my day

  23. I got this problem when entering this tar -xzvf/ root/jdk-7u79-linux-i586.tar.gz
    tar (child): /root/jdk-7u79-linux-i586.tar.gz: Cannot open: No such file or directory
    tar (child): Error is not recoverable: exiting now
    tar: Child returned status 2 tar: Error is not recoverable: exiting now

    How could I solve this problem?

  24. Nice Work by admin…
    also you can use script i made, simple run script and enjoy….
    get script at https://cyberghosts.wordpress.com/2016/11/30/update-java-in-kali-linux/

  25. thanks a lot, admin!

  26. Thanks!

    My install: jdk1.8.0_121 for KaliLinux 2017 on Intel 32bit system

    root@kali:~# cd /opt
    root@kali:/opt# ls
    jdk1.8.0_121 Teeth
    root@kali:/opt# cd jdk1.8.0_121
    root@kali:/opt/jdk1.8.0_121# update-alternatives –install /usr/bin/java java /opt/jdk1.8.0_121/bin/java 1
    root@kali:/opt/jdk1.8.0_121# update-alternatives –install /usr/bin/javac javac /opt/jdk1.8.0_121/bin/javac 1
    root@kali:/opt/jdk1.8.0_121# update-alternatives –install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.8.0_121/jre/lib/i386/libnpjp2.so 1
    root@kali:/opt/jdk1.8.0_121# update-alternatives –set java /opt/jdk1.8.0_121/bin/java
    update-alternatives: using /opt/jdk1.8.0_121/bin/java to provide /usr/bin/java (java) in manual mode
    root@kali:/opt/jdk1.8.0_121# update-alternatives –set javac /opt/jdk1.8.0_121/bin/javac
    update-alternatives: using /opt/jdk1.8.0_121/bin/javac to provide /usr/bin/javac (javac) in manual mode
    root@kali:/opt/jdk1.8.0_121# update-alternatives –set mozilla-javaplugin.so /opt/jdk1.8.0_121/jre/lib/i386/libnpjp2.so
    update-alternatives: using /opt/jdk1.8.0_121/jre/lib/i386/libnpjp2.so to provide /usr/lib/mozilla/plugins/libjavaplugin.so (mozilla-javaplugin.so) in manual mode
    root@kali:/opt/jdk1.8.0_121#

  27. Really that is good for all Kali Linux user and it is working

Leave your solution or comment to help others.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from blackMORE Ops

Subscribe now to keep reading and get access to the full archive.

Continue reading

Privacy Policy on Cookies Usage

Some services used in this site uses cookies to tailor user experience or to show ads.