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

Incoming search terms:

Related posts

83 thoughts on “How to install oracle java 7 in ubuntu 13.04/12.10/12.04

  1. 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

    [Reply]

    Patrick Reply:

    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

    [Reply]

    anthony Reply:

    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.

    [Reply]

    falzer Reply:

    how can i do that??

    [Reply]

    anthony Reply:

    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.

    maronezzi Reply:

    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?

    [Reply]

    Anthony Reply:

    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?

    falzer Reply:

    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*

    maronezzi Reply:

    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..

    maronezzi Reply:

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

    falzer Reply:

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

    maronezzi Reply:

    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

  2. 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)

    [Reply]

    Sindy Reply:

    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!

    [Reply]

    falzer Reply:

    try my answer above.

    [Reply]

  3. Hi…

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

    Thanks for that falzer.

    [Reply]

  4. 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:

    [Reply]

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

    you may have downloaded jre 7u4 instead of 7u3

    [Reply]

  6. 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

    [Reply]

    migo Reply:

    Thanks, that saved me a lot of time!!

    [Reply]

    John Reply:

    Worked for me aswell! Thank you

    [Reply]

    Juan Reply:

    Thanks a Lot, this was what works for me …

    [Reply]

    joker159-France Reply:

    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 !! :)

    [Reply]

    Zilther Reply:

    You are a god among men.

    [Reply]

  7. Nope, no workie:
    ric@Iam:~$ 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)
    ric@Iam:~$

    [Reply]

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

    [Reply]

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

    Done.

    [Reply]

  10. sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    sudo apt-get install oracle-java7-installer
    “For Uninstallation”
    sudo apt-get remove oracle-java7-installer

    How exactly it works?

    [Reply]

  11. wrong: sudo apt-get purge openjdk*
    correct: sudo apt-get purge ‘openjdk*’
    a glob expansion could occur.

    wrong: sudo apt-get purge openjdk*
    correct: sudo apt-get purge ‘^openjdk.*’
    a purge(search, remove) option take a regular expression not a glob expression.

    [Reply]

  12. The minimal ubuntu server install does not include add-apt-repository. You can install it with the following prior to running the other commands.

    sudo apt-get install software-properties-common

    [Reply]

  13. Had problem with my Java 7 in Ubuntu 12.10. Followed these instruction to the letter, worked perfectly. Thank you!

    [Reply]

  14. Just tried to install a Tekkit (Minecraft) server on my Linux box – thought it might be the Java 6 install of OpenJDK I had installed. Using your guide allowed me to get rid of that and get Oracle’s 7 installed in no time at all – and the Tekkit server is working nicely. Great job!

    [Reply]

Leave a comment

Your email address will not be published. Required fields are marked *