Page 1 of 2 12 LastLast
Results 1 to 50 of 51

Thread: Installing Java on Kali-Linux

  1. #1
    Join Date
    2013-Mar
    Posts
    1

    Installing Java on Kali-Linux

    1. Download the latest Java SE SDK version.

    http://www.oracle.com/technetwork/ja...ads/index.html

    At the time of writing the filename and version was jdk-7u17-linux-x64.tar.gz

    2. Untar the Archive
    tar -xzvf /root/jdk-7u17-linux-x64.tar.gz
    mv jdk1.7.0_17 /opt
    cd /opt/jdk1.7.0_17

    3.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_17/bin/java 1
    update-alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_17/bin/javac 1
    update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.7.0_17/jre/lib/amd64/libnpjp2.so 1
    update-alternatives --set java /opt/jdk1.7.0_17/bin/java
    update-alternatives --set javac /opt/jdk1.7.0_17/bin/javac
    update-alternatives --set mozilla-javaplugin.so /opt/jdk1.7.0_17/jre/lib/amd64/libnpjp2.so

    4. Test

    To check the version of Java you are now running

    java -version

    To check the browser plugin browse to http://www.java.com/ and click “Do I have Java?”

  2. #2
    Join Date
    2013-Mar
    Posts
    1
    i think step 3 dosen't work since when i try java -version i get
    Code:
    bash: /usr/bin/java: cannot execute binary file

  3. #3
    Join Date
    2013-Mar
    Posts
    1
    Quote Originally Posted by Dark_4ngel View Post
    i think step 3 dosen't work since when i try java -version i get
    Code:
    bash: /usr/bin/java: cannot execute binary file

    everything works, just download&install 32 bit version instead of 64 bit.

    And in step 3 change /amd64/ to /i386/

  4. #4
    In the steps above it is using 64bit software, Dark_4ngel, are you running a 64Bit Kali install or 32?

    Not sure but that may be the issue.

  5. #5
    Join Date
    2013-Mar
    Posts
    2
    Confirmed working.
    root@localhost:~# tar -xzvf jdk-7u17-linux-x64.tar.gz
    jdk1.7.0_17/
    jdk1.7.0_17/include/
    [..]
    root@localhost:~# mv jdk1.7.0_17 /opt
    root@localhost:~# cd /opt/jdk1.7.0_17/
    root@localhost:/opt/jdk1.7.0_17#
    root@localhost:/opt/jdk1.7.0_17# update-alternatives --install /usr/bin/java java /opt/jdk1.7.0_17/bin/java 1
    root@localhost:/opt/jdk1.7.0_17# update-alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_17/bin/javac 1
    root@localhost:/opt/jdk1.7.0_17# update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.7.0_17/jre/lib/amd64/libnpjp2.so 1
    update-alternatives: /opt/jdk1.7.0_17/jre/lib/amd64/libnpjp2.so wird verwendet, um /usr/lib/mozilla/plugins/libjavaplugin.so (mozilla-javaplugin.so) im Auto-Modus bereitzustellen
    root@localhost:/opt/jdk1.7.0_17# update-alternatives --set java /opt/jdk1.7.0_17/bin/java
    update-alternatives: /opt/jdk1.7.0_17/bin/java wird verwendet, um /usr/bin/java (java) im manueller Modus bereitzustellen
    root@localhost:/opt/jdk1.7.0_17# update-alternatives --set javac /opt/jdk1.7.0_17/bin/javac
    update-alternatives: /opt/jdk1.7.0_17/bin/javac wird verwendet, um /usr/bin/javac (javac) im manueller Modus bereitzustellen
    root@localhost:/opt/jdk1.7.0_17# update-alternatives --set mozilla-javaplugin.so /opt/jdk1.7.0_17/jre/lib/amd64/libnpjp2.so
    root@localhost:/opt/jdk1.7.0_17# java -version
    java version "1.7.0_17"
    Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
    Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

  6. #6
    Join Date
    2013-Mar
    Posts
    2
    everything's working bro...

  7. #7
    Join Date
    2013-Mar
    Location
    localhost
    Posts
    41
    Nice thank you.

  8. #8
    Join Date
    2013-Mar
    Location
    Malaysia
    Posts
    1
    it's working....thanks....
    If you can dream big,than you can courage yourself to work hard till you achieve it

  9. #9
    Join Date
    2013-Mar
    Location
    Bangalore
    Posts
    3
    Thank you for your useful information.

  10. #10
    Join Date
    2013-Apr
    Posts
    1
    Thank you...

  11. #11
    Join Date
    2013-Mar
    Location
    Canada
    Posts
    5
    Thanks brah! Worked exactly as described (64bit)

  12. #12
    Join Date
    2013-Apr
    Location
    Morelos Mexico
    Posts
    1
    thanks bro worked for me

  13. #13
    Join Date
    2013-Apr
    Posts
    5
    thanks pro....

  14. #14
    Join Date
    2013-Apr
    Posts
    1
    Not Working With me Pls Help

  15. #15
    Join Date
    2013-Mar
    Posts
    1
    Install the package icedtea-7-plugin command like:

    # apt-get install icedtea-7-plugin

    Restart your browser and test.

    I hope I helped.

  16. #16
    Join Date
    2013-Apr
    Posts
    10
    Is it some major problem to update java after i install it
    - after i installed 17 it says update 21 is available and i don't feel like getting burned right now

  17. #17
    Join Date
    2013-May
    Posts
    1

    Red face Latest commands to install as per above with i386

    tar -xzvf /root/jdk-7u21-linux-i586.tar.gz

    mv jdk1.7.0_21 /opt

    cd /opt/jdk1.7.0_21

    update-alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_21/bin/javac 1

    update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.7.0_21/jre/lib/i386/libnpjp2.so 1

    update-alternatives --set java /opt/jdk1.7.0_21/bin/java

    update-alternatives --set javac /opt/jdk1.7.0_21/bin/javac

    update-alternatives --set mozilla-javaplugin.so /opt/jdk1.7.0_21/jre/lib/i386/libnpjp2.so

  18. #18
    Join Date
    2013-May
    Posts
    2
    This tutorial is for 64 bit and 32bit but it works with some minor changes:

    1. Download the latest Java SE SDK version.

    At the time of writing the filename and version was jdk-7u21-linux-i586.tar.gz

    2. Untar the Archive
    tar -xzvf /root/jdk-7u21-linux-i586.tar.gz
    mv jdk1.7.0_21 /opt
    cd /opt/jdk1.7.0_21

    3.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_21/bin/java 1
    update-alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_21/bin/javac 1
    update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.7.0_21/jre/lib/i384/libnpjp2.so 1
    update-alternatives --set java /opt/jdk1.7.0_21/bin/java
    update-alternatives --set javac /opt/jdk1.7.0_21/bin/javac
    update-alternatives --set mozilla-javaplugin.so /opt/jdk1.7.0_21/jre/lib/i386/libnpjp2.so

    4. Test

    To check the version of Java you are now running

    http://java.com/en/download/testjava.jsp

  19. #19
    Join Date
    2013-Apr
    Location
    Up there somewhere X)...
    Posts
    17
    will test later, and give feedback, thanks! ...

  20. #20
    Join Date
    2013-May
    Posts
    2
    Post post post
    Last edited by samcn; 2013-10-03 at 18:11.

  21. #21
    Code:
    sudo apt-get purge openjdk*
    - I'm not sure that it's a good ideea. By doing that you'll got to handle such:

    "The following packages will be REMOVED:
    android-sdk* ant* ant-optional* apktool* armitage* bluepot* burpsuite*
    ca-certificates-java* casefile* dbpwaudit* default-jdk* default-jre*
    default-jre-headless* dex2jar* dirbuster* icedtea-6-jre-cacao*
    icedtea-6-jre-jamvm* icedtea-7-jre-cacao* icedtea-7-jre-jamvm* icedtea-netx*
    javasnoop* magictree* maltego* metasploit* openjdk-6-jdk* openjdk-6-jre*
    openjdk-6-jre-headless* openjdk-6-jre-lib* openjdk-7-jdk* openjdk-7-jre*
    openjdk-7-jre-headless* openjdk-7-jre-lib* oscanner* paros* patator*
    protos-sip* smali* vega* webscarab* xmind* zaproxy*

    The following NEW packages will be installed:
    gcj-4.7-base gcj-4.7-jre gcj-4.7-jre-headless gcj-4.7-jre-lib gcj-jre
    gcj-jre-headless libgcj-common libgcj13 libgcj13-awt
    0 upgraded, 9 newly installed, 41 to remove and 0 not upgraded.
    Need to get 24.5 MB of archives.
    After this operation, 996 MB disk space will be freed.
    "
    Think twice before say YES.

  22. #22
    Quote Originally Posted by r3ng4f View Post
    Install the package icedtea-7-plugin command like:

    # apt-get install icedtea-7-plugin

    Restart your browser and test.

    I hope I helped.
    Thank you mate. One of the most simple and safest solution. 100% worked out.

  23. #23
    Join Date
    2013-Mar
    Posts
    29
    It seems like Java breaks for me every time there's a new update or something available. I'm not sure what the deal is. One minute it works, the next minute it doesn't. I always find myself having to come back to this thread, downloading a newer version of Java, and then executing those commands again.

    Is there any way I could get some assistance diagnosing this? Pretty annoying to have it stop working all of a sudden.

  24. #24
    Join Date
    2013-Jul
    Location
    Portugal
    Posts
    1
    UPDATED THIS POST FOR versions x86
    java version (jdk-7u25-linux-i586)


    1. Download the latest Java SE SDK version.

    http://www.oracle.com/technetwork/ja...ads/index.html

    The version at the time i did the post jdk-7u25-linux-i586.tar.gz

    2. Untar the Archive
    tar -xzvf /root/jdk-7u17-linux-x64.tar.gz
    mv jdk1.7.0_17 /opt
    cd /opt/jdk1.7.0_17

    3.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_25/bin/java 1
    update-alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_25/bin/javac 1
    update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.7.0_25/jre/lib/i386/libnpjp2.so 1
    update-alternatives --set java /opt/jdk1.7.0_25/bin/java
    update-alternatives --set javac /opt/jdk1.7.0_25/bin/javac
    update-alternatives --set mozilla-javaplugin.so /opt/jdk1.7.0_25/jre/lib/i386/libnpjp2.so

    4. Test

    To check the version of Java you are now running

    java -version

    To check the browser plugin browse to http://www.java.com/ and click “Do I have Java?”

    Keep Up

  25. #25
    Join Date
    2013-Aug
    Posts
    2
    I have a problem in the last step , your help plzzz !!!
    root@Kali-PC:/opt/jdk1.7.0_25# update-alternatives --install /usr/bin/java java /opt/jdk1.7.0_25/bin/java 1
    root@Kali-PC:/opt/jdk1.7.0_25# update-alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_25/bin/javac 1
    root@Kali-PC:/opt/jdk1.7.0_25# update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.7.0_25//jre/lib//i386/libnpjp2.so 1
    update-alternatives: using /opt/jdk1.7.0_25//jre/lib//i386/libnpjp2.so to provide /usr/lib/mozilla/plugins/libjavaplugin.so (mozilla-javaplugin.so) in auto mode
    root@Kali-PC:/opt/jdk1.7.0_25# update-alternatives --set java /opt/jdk1.7.0_25/bin/java
    update-alternatives: using /opt/jdk1.7.0_25/bin/java to provide /usr/bin/java (java) in manual mode
    root@Kali-PC:/opt/jdk1.7.0_25# update-alternatives --set javac /opt/jdk1.7.0_25/bin/javac
    update-alternatives: using /opt/jdk1.7.0_25/bin/javac to provide /usr/bin/javac (javac) in manual mode
    root@Kali-PC:/opt/jdk1.7.0_25# update-alternatives --set mozilla-javaplugin.so /opt/jdk1.7.0_25//jre/lib/i386/libnpjp2.so
    update-alternatives: error: alternative /opt/jdk1.7.0_25//jre/lib/i386/libnpjp2.so for mozilla-javaplugin.so not registered; not setting

  26. #26
    Join Date
    2013-Jul
    Posts
    8
    hurrah its done i have java installed on my kali os

  27. #27
    Join Date
    2013-Aug
    Posts
    1
    Worked perfectly thanks.

  28. #28
    Join Date
    2013-Sep
    Posts
    1
    When I type
    update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.7.0_25/jre/lib/amd64/libnpjp2.so 1
    it gives me
    update-alternatives: erreur: le chemin alternatif /opt/jdk1.7.0_25/jre/lib/amd64/libnpjp2.so n'existe pas
    which means that that pathway doen't exist, can someone help me plz? :/

  29. #29
    Join Date
    2013-Sep
    Posts
    1
    Thanks a lot, works perfectly with jdk1.7.0_40

  30. #30
    Join Date
    2013-Sep
    Posts
    16
    I tried this method and succeeded

    after the download from the link
    http://www.java.com/en/download/index.jsp
    #ls
    #tar zxvf jre-7u40-linux-x64.tar.gz
    #killall -9 /opt/firefox/firefox-bin
    #mkdir /opt/java
    #update-alternatives --install /usr/bin/java java /opt/java/jre1.7.0_40/bin/java 1
    #update-alternatives --set java /opt/java/jre1.7.0_40/bin/java
    #ln -sf /opt/java/jre1.7.0_40/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins/
    #export JAVA_HOME="/opt/java/jre1.7.0_40/bin/java"
    #firefox http://java.com/en/download/testjava.jsp

    for more information
    http://www.backtrack-linux.org/wiki/...p/Java_Install

  31. #31
    Join Date
    2013-Sep
    Posts
    16
    After downloading the latest version 7.0-40 Java you should change the number 7 in all orders to 40 and Enjoy

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


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

    The above commands are used for 64-bit Systems

  32. #32
    Join Date
    2013-Mar
    Posts
    1
    any idea howto install sun jdk 6?
    android build system not working with other version
    thanks

  33. #33
    Join Date
    2013-Nov
    Location
    The lesser Vegas. Reno.
    Posts
    2
    Quote Originally Posted by enoks View Post
    UPDATED THIS POST FOR versions x86
    java version (jdk-7u25-linux-i586)


    1. Download the latest Java SE SDK version.

    http://www.oracle.com/technetwork/ja...ads/index.html

    The version at the time i did the post jdk-7u25-linux-i586.tar.gz

    2. Untar the Archive
    tar -xzvf /root/jdk-7u17-linux-x64.tar.gz
    mv jdk1.7.0_17 /opt
    cd /opt/jdk1.7.0_17

    3.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_25/bin/java 1
    update-alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_25/bin/javac 1
    update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.7.0_25/jre/lib/i386/libnpjp2.so 1
    update-alternatives --set java /opt/jdk1.7.0_25/bin/java
    update-alternatives --set javac /opt/jdk1.7.0_25/bin/javac
    update-alternatives --set mozilla-javaplugin.so /opt/jdk1.7.0_25/jre/lib/i386/libnpjp2.so

    4. Test

    To check the version of Java you are now running

    java -version

    To check the browser plugin browse to http://www.java.com/ and click “Do I have Java?”

    Keep Up

    Thank you! Followed these steps exactly with 32bit and the newest version of java simply changing the 25 to a 45 and everything worked flawlessly. Much appreciated.

  34. #34
    Join Date
    2013-Nov
    Posts
    2
    Working like described! THX

  35. #35
    Join Date
    2013-Nov
    Posts
    1
    thxxxxxxxxxxxxxxxxxxxxxxxx

  36. #36
    Join Date
    2013-Sep
    Location
    Indonesia
    Posts
    2
    It's Still Work for jdk-7u45-linux-x64.tar.gz thank you Bro..

  37. #37
    Join Date
    2014-Mar
    Posts
    2
    thanks for the guide.
    just adding, this is for jdk download, for other download like jre, the folder name and subfolders will be a bit different and you have to adjust yourself.

  38. #38
    Join Date
    2014-Mar
    Posts
    1
    Quote Originally Posted by purehate View Post
    1. Download the latest Java SE SDK version.

    http://www.oracle.com/technetwork/ja...ads/index.html

    At the time of writing the filename and version was jdk-7u17-linux-x64.tar.gz

    2. Untar the Archive
    tar -xzvf /root/jdk-7u17-linux-x64.tar.gz
    mv jdk1.7.0_17 /opt
    cd /opt/jdk1.7.0_17

    3.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_17/bin/java 1
    update-alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_17/bin/javac 1
    update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.7.0_17/jre/lib/amd64/libnpjp2.so 1
    update-alternatives --set java /opt/jdk1.7.0_17/bin/java
    update-alternatives --set javac /opt/jdk1.7.0_17/bin/javac
    update-alternatives --set mozilla-javaplugin.so /opt/jdk1.7.0_17/jre/lib/amd64/libnpjp2.so

    4. Test

    To check the version of Java you are now running

    java -version

    To check the browser plugin browse to http://www.java.com/ and click “Do I have Java?”
    In case people are still using these instructions, I thought I'd report that I used them to get java working using jdk-7u51-linux-x64.tar.gz. I just changed all the _17 to _51. However, the interesting thing to me was that I got a message saying there was an error. But never the less it all worked.

  39. #39
    Join Date
    2014-Mar
    Location
    Apparently Holland
    Posts
    3
    Why am I approched by this error?
    Code:
    root@kali:/opt/jdk1.7.0_51# update-alternatives --install /usr/bin/java java /opt/jdk1.7.0_51/bin/java 1
    update-alternatives: error: alternative path /opt/jdk1.7.0_51/bin/java doesn't exist

    My post about fixing E0F error(which i assume youre talking about jwg) hasnt been approved yet.

  40. #40
    Join Date
    2014-Apr
    Posts
    1
    i know im just doing asomething stupid but when i do step 3 -
    install /usr/bin/java java /opt/jdk1.7.0_17/bin/java 1

    i get no directory 1 help please

  41. #41
    Join Date
    2014-Nov
    Posts
    1
    So I get a message while using firefox that I need a java update on my browser. The warning window does not close in spite of having a leave the page button. Even after restarting and deleting temp files, this window has now closed. I feel its malware and my norton antivirus has not worked.

    I already feel my yahoo mail has been compromised, I am being asked to suddenly change my password.

    then i cleared these issues by following few steps over a article post.
    http://www.omgtop5.com/how-to-verify...dows-browsers/

    i make that per-requirement to browsers under your OS, checking the prefect driver of java for both system and browsers. verify by mail, updates ....finally issues will be clear, sometimes without update its will be installs the default version from download center.

  42. #42
    Join Date
    2015-Mar
    Posts
    1
    Thanks, you saved me many struggles getting java jdk to work.

  43. #43
    Join Date
    2015-Oct
    Posts
    1
    well necropost
    but thx to this topic
    was helpfull

  44. #44
    Join Date
    2015-Nov
    Posts
    1
    "How can i copy my already downloaded jdk-7u17-linux-x64.tar.gz file to root folder.? "

  45. #45
    Join Date
    2016-Feb
    Posts
    4
    Works on Kali 2016.1 jdk 8u73, just replace the version number, right know I have an issue with Webex but I'm figuring out how to solve

  46. #46
    Join Date
    2016-Mar
    Location
    London
    Posts
    2
    In case anyone feel lazy please see the script you can use to automate it - ofcourse based solely on idea published by author of the thread (thank you for this):

    # 1. Download the latest Java SE SDK version.

    # http://www.oracle.com/technetwork/ja...ads/index.html
    #
    # cd to directory where .gz has been downloaded
    #
    # 2. pass the archive as an argument to the script -> script.sh jdk-7u17-linux-x64.tar.gz
    #
    # Default location is /usr/java for me - don't like it just pass /opt or /opt/java as second argument
    # For example: script.sh jdk-7u17-linux-x64.tar.gz /opt/java
    #
    # The script heavily based on author's idea, please copy save it to script.sh of javaAlternatives.sh or else..
    #

    #!/bin/bash
    #

    tar -xzvf $1
    echo "extracted"

    JAVA_WHERE_TO=$2

    JAVA_VER=$(ls . | grep 'jdk[[:digit:].[:digit:].[:digit:]]_*')
    echo "Found java: " $JAVA_VER

    if [[ ! $JAVA_WHERE_TO ]]; then
    JAVA_WHERE_TO="/usr/java"
    fi

    mkdir -p $JAVA_WHERE_TO
    mv $JAVA_VER $JAVA_WHERE_TO/

    update-alternatives --install /usr/bin/java java $JAVA_WHERE_TO/$JAVA_VER/bin/java 1
    update-alternatives --install /usr/bin/javac javac $JAVA_WHERE_TO/$JAVA_VER/bin/javac 1
    update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so $JAVA_WHERE_TO/$JAVA_VER/jre/lib/amd64/libnpjp2.so 1
    update-alternatives --set java /usr/java/$JAVA_VER/bin/java
    update-alternatives --set javac /usr/java/$JAVA_VER/bin/javac
    update-alternatives --set mozilla-javaplugin.so /usr/java/$JAVA_VER/jre/lib/amd64/libnpjp2.so


    # To check the version of Java you are now running
    echo ">----- Testing Java -----<"
    java -version

    # To check the browser plugin browse to http://www.java.com/ and click “Do I have Java?”
    nohup x-www-browser http://www.java.com/ &
    ## END of the script

    ## To use the plugin you need to adjust java security settings cause in some cases it won't work.

    # Again thank you to the author for this idea

  47. #47
    Join Date
    2016-Mar
    Location
    London
    Posts
    2
    In case anyone feel lazy please see the script you can use to automate it - ofcourse based solely on idea published by author of the thread (thank you for this):

    # 1. Download the latest Java SE SDK version.

    # http://www.oracle.com/technetwork/ja...ads/index.html
    #
    # cd to directory where .gz has been downloaded
    #
    # 2. pass the archive as an argument to the script -> script.sh jdk-7u17-linux-x64.tar.gz
    #
    # Default location is /usr/java for me - don't like it just pass /opt or /opt/java as second argument
    # For example: script.sh jdk-7u17-linux-x64.tar.gz /opt/java
    #
    # The script heavily based on author's idea, please copy save it to script.sh of javaAlternatives.sh or else..
    #

    #!/bin/bash
    #

    tar -xzvf $1
    echo "extracted"

    JAVA_WHERE_TO=$2

    JAVA_VER=$(ls . | grep 'jdk[[:digit:].[:digit:].[:digit:]]_*')
    echo "Found java: " $JAVA_VER

    if [[ ! $JAVA_WHERE_TO ]]; then
    JAVA_WHERE_TO="/usr/java"
    fi

    mkdir -p $JAVA_WHERE_TO
    mv $JAVA_VER $JAVA_WHERE_TO/

    update-alternatives --install /usr/bin/java java $JAVA_WHERE_TO/$JAVA_VER/bin/java 1
    update-alternatives --install /usr/bin/javac javac $JAVA_WHERE_TO/$JAVA_VER/bin/javac 1
    update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so $JAVA_WHERE_TO/$JAVA_VER/jre/lib/amd64/libnpjp2.so 1
    update-alternatives --set java $JAVA_WHERE_TO/$JAVA_VER/bin/java
    update-alternatives --set javac $JAVA_WHERE_TO/$JAVA_VER/bin/javac
    update-alternatives --set mozilla-javaplugin.so $JAVA_WHERE_TO/$JAVA_VER/jre/lib/amd64/libnpjp2.so


    # To check the version of Java you are now running
    echo ">----- Testing Java -----<"
    java -version

    # To check the browser plugin browse to http://www.java.com/ and click “Do I have Java?”
    nohup x-www-browser http://www.java.com/ &
    ## END of the script

    ## To use the plugin you need to adjust java security settings cause in some cases it won't work.

    # Again thank you to the author for this idea

  48. #48
    I have a 32-bit system and yes I made the necessary modifications but I still get this error upon running java -version

    Error occurred during initialization of VM
    java/lang/NoClassDefFoundError: java/lang/Object

    I am not sure where the error occurred since nothing like this happened when I used the commands.

    Here are the actual commands I used:

    update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_92/bin/java 1
    update-alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_92/bin/javac 1
    update-aternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/jdk1.8.0_92/jre/lib/i386/libjawt.so 1
    update-alternatives --set java /opt/jdk1.8.0_92/bin/java
    update-alternatives --set javac /opt/jdk1.8.0_92/bin/javac
    update-alternatives --set mozilla-javaplugin.so /opt/jdk1.8.0_92/jre/lib/i386/libjawt.so

    I executed all of these from the directory:

    root@myComputer:/opt/jdk1.8.0_92#

    One thing I did is that I extracted the contents to my home directory then later copied the jdk1.8.0_92 directory and all of its contents to the /opt directory later. I doubt that makes any difference but I'm willing to try anything at this point.

    If anybody else had a similar issue please respond.

  49. #49
    Join Date
    2016-Nov
    Posts
    1

    Simple RUn Script given in link and Enjoy..

    NEED not to perform this much things... simple go and download script run and woooha java updated..
    https://cyberghosts.wordpress.com/20...-in-kali-linux

  50. #50
    was looking for this. Thanks! it worked.

Similar Threads

  1. Install Java 8 on Kali-Linux
    By R.3volv3.R in forum How-To Archive
    Replies: 0
    Last Post: 2014-03-22, 11:18
  2. Replies: 31
    Last Post: 2013-12-04, 13:57
  3. Unable to install java on Kali Linux
    By indrajithi in forum TroubleShooting Archive
    Replies: 5
    Last Post: 2013-07-18, 17:42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •