How to install oracle java 7 in ubuntu 13.04/12.10/12.04

Java is a programming language and computing platform first released by Sun Microsystems in 1995. It is the underlying technology that powers state-of-the-art programs including utilities, games, and business applications. Java runs on more than 850 million personal computers worldwide, and on billions of devices worldwide, including mobile and TV devices.

Preparing your system

First you need to remove openjdk for this run the following command from your terminal

sudo apt-get purge openjdk*

If you installed java 7 from any other PPA and you are having problem with java then you have to do following steps before installing the PPA menctioned here

sudo rm /var/lib/dpkg/info/oracle-java7-installer*
sudo apt-get purge oracle-java7-installer*
sudo rm /etc/apt/sources.list.d/*java*
sudo apt-get update

Install oracle java 7 in ubuntu 13.04/12.10/12.04

Open the terminal and run the following commands

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

You can check the java version by searching java in dashboard

Sponsored Link

Related posts

You may also like...

83 Responses

  1. Ross says:

    I had a problem with this. I was getting

    sha256sum mismatch jdk-7u3-linux-x64.tar.gz

    I checked the file in
    /var/cache/oracle-java7-installer

    and it looked like it was invalid

    I was able to fix it by directly downloading the file from oracle, putting it in the cache directory and then editing

    /var/lib/dpkg/info/oracle-java7-installer.postinst

    and bypassing ths download and sha check

    This problem just started happening today, I used the package successfully yesterday on a different computer

  2. Patrick says:

    The problem is that the java download package is malformed and only contains an Unauthorized Download message and info.

    It seems Oracle prevents direct downloads

  3. anthony says:

    Thanks – that solved the problem for me too – just had to put the jdk-7u3-linux-x64.tar.gz file into /var/cache/oracle-java7-installer/ and then comment out the code between ‘echo “Downloading…”‘
    and ‘echo “Download done”‘ in the /var/lib/dpkg/info/oracle-java7-installer.postinst script.

  4. falzer says:

    how can i do that??

  5. anthony says:

    Use a text editor to open the file and put a “#” at the start of each line between ‘echo “Downloading…”‘
    and ‘echo “Download done” in the file, then save it.

  6. kei says:

    I had this problem too!
    ?????: “./jdk-7u3-linux-x64.tar.gz”

    0K ..... 100% 574M=0s

    2012-04-10 11:23:56 (574 MB/s) - ??? “./jdk-7u3-linux-x64.tar.gz” [5307/5307])

    Download done.
    sha256sum mismatch jdk-7u3-linux-x64.tar.gz
    Oracle JDK 7 is NOT installed.
    dpkg??? oracle-java7-installer (--configure)????
    ??? ??? post-installation ?? ?????? 1
    ??????????
    oracle-java7-installer
    E: Sub-process /usr/bin/dpkg returned an error code (1)

  7. Sindy says:

    Pls help. I am facing the same problem here. I am not able to install any version of java, and my entire work has stopped because of this! 🙁 I am on Natty!

  8. maronezzi says:

    Hi Anthony, i make that change, it’s pass, and i need to comment the code for a “verify SHA256 checksum” but now a get this error:

    mv: impossível obter estado de “jdk1.7.0_03”: Arquivo ou diretório não encontrado
    dpkg: erro processando oracle-java7-installer (–configure):
    sub-processo script post-installation instalado retornou estado de saída de erro 1
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    Do you now how can i fix this?

  9. Anthony says:

    I don’t speak spanish – can you translate that for me?

    Also, I don’t know why you need to comment the code for verifying the SHA256 checksum… why are you doing that?

  10. falzer says:

    I found this and worked:

    OK figured out how to install.
    Download tar.gz from here: http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u3-download-1501626.html

    and place it to: var/cache/oracle-java7-installer
    then open with text editor: var/lib/dpkg/info/oracle-java7-installer.postinst
    and place # (or delete) in beginning of these lines: 74-107, 111-116
    and then run again sudo apt-get purge openjdk*

  11. falzer says:

    try my answer above.

  12. maronezzi says:

    Anthony,

    i need to comment the SHA256 checksum because give me a error and stop.

    Here:

    mv: can not get status “jdk1.7.0_03”: File or directory not found
    dpkg: error processing oracle-java7-installer (- configure):
    subprocess post-installation script returned error exit status 1
    E: Sub-process / usr / bin / dpkg returned an error code (1)

    falzer the error continue..

  13. maronezzi says:

    I had already tested this, yesterday, but doesn’t work.

  14. falzer says:

    maybe you commented something in post-installation that was not to be commented. have u tried it from beggining?

  15. poltiser says:

    After installing repo I just install it from synaptic… 😉
    It works.

  16. maronezzi says:

    I use this tuto to install and its works:

    http://www.liberiangeek.net/2012/04/install-oracle-java-jdk-7-in-ubuntu-12-04-precise-pangolin/

    $ cp /usr/lib/jni/libswt-*3740.so ~/.swt/lib/linux/x86

  17. JFSF says:

    Hi…

    After some errors and testing, i found out that following the proposal of falzer is the best solution.

    Thanks for that falzer.

  18. Steve says:

    I followed falzer’s solution and still, I got this:

    Download done.
    sha256sum mismatch jdk-7u3-linux-x64.tar.gz
    Oracle JDK 7 is NOT installed.
    dpkg: error processing oracle-java7-installer (–configure):
    subprocess installed post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of oracle-jdk7-installer:
    oracle-jdk7-installer depends on oracle-java7-installer; however:
    Package oracle-java7-installer is not configured yet.
    dpkg: error processing oracle-jdk7-installer (–configure):
    dependency problems – leaving unconfigured
    No apport report written because the error message indicates its a followup error from a previous failure.
    Errors were encountered while processing:

  19. replying2steve says:

    that basically means that the checksum in the install script did not match,

    you may have downloaded jre 7u4 instead of 7u3

  20. cga says:

    This is what works for me

    sudo rm /var/lib/dpkg/info/oracle-java7-installer*
    sudo apt-get purge oracle-java7-installer*
    sudo rm /etc/apt/sources.list.d/*java*
    sudo apt-get update
    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java7-installer

  21. meck says:

    Thanks to cga. That works for me too!

  22. migo says:

    Thanks, that saved me a lot of time!!

  23. John says:

    Worked for me aswell! Thank you

  24. Juan says:

    Thanks a Lot, this was what works for me …

  25. Rickey Moore says:

    Nope, no workie:
    [email protected]:~$ sudo apt-get install oracle-java7-installer
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    oracle-java7-installer is already the newest version.
    0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
    1 not fully installed or removed.
    After this operation, 0 B of additional disk space will be used.
    Do you want to continue [Y/n]? y
    Setting up oracle-java7-installer (7u4-0~webupd8~4) …
    Removing outdated cached downloads…
    Downloading cookie…
    –2012-06-12 02:48:22– http://launchpadlibrarian.net/98645053/cookie.txt
    Resolving iam.wayward4now.net (iam.wayward4now.net)… 192.168.0.2
    Connecting to iam.wayward4now.net (iam.wayward4now.net)|192.168.0.2|:3142… connected.
    Proxy request sent, awaiting response… 403 Forbidden file type or location: http://launchpadlibrarian.net/98645053/cookie.txt
    2012-06-12 02:48:22 ERROR 403: Forbidden file type or location: http://launchpadlibrarian.net/98645053/cookie.txt.

    download failed
    Oracle JDK 7 is NOT installed.
    dpkg: error processing oracle-java7-installer (–configure):
    subprocess installed post-installation script returned error exit status 1
    Errors were encountered while processing:
    oracle-java7-installer
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    [email protected]:~$

  26. Rickey Moore says:

    p/s this was my second attempt after following all the instructions to remove all traces of a previous install.

  27. Davem says:

    @cga: you are a genius, thank you

  28. joker159-France says:

    Thanks Cga works very well !!, it installed very well, in firefox and google chrome !

    Hey ubuntu geek website, please can you add cga response to your post in update, I’m sure it’ll help lots of people !! 🙂

  29. fenietzsche says:

    As @poltiser said:
    Add the repository and update repositories.
    Then, open Synaptic and install Oracle Java.

    Done.

Leave a Reply

Your email address will not be published.