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.
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.
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.
Thank you
You're welcome Phelipe.
Thank you. Great tutorial!!! :)
Thanks. Glad it helped you.
thank you very much
i get question how about this ???
no alternatives for mozilla
when i check my java is 1.6 version
please reply me …..:(
what if i have a Iceweasl browser..what changes in command of mozilla??
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
Sorry, one final question. Why extract it to the root folder instead of creating a separate folder for it inside of root?
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.
I looked the website and there is no 32-bit version?!
(x86) is another name for 32-bit version. Download that one.
gracias :)
How can i install jre java ?
Thanks in advance
Guide needs to be updated in accordance with the latest JDK.
installing jdk 1.8.0_31 but not well confiqured
Dont forget :
apt-get install icedtea-7-plugin
This allows Java to work in your browser (if thats what you want)
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
I’m sure you haven’t copy the JDK file into your root as bMO said in the guide.
This still applies. Thanks!
Thanks Robert. Appreciate the feedback.
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?
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
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
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 ?
helpful .. useful and it works … thx for help u save my day
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?
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/
thanks a lot, admin!
Thanks bro
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#
thank you !!!
Really that is good for all Kali Linux user and it is working