Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to install Liferay on Ubuntu Server 12.04, which requires JRE and recommends version 6.

I can't find JRE6 in an authoritative repository, and I can't work out how to get past the licence agreement for a manual (wget) download.

Can I add a value to wget to accept the Oracle licence agreement and download the file?


share|improve this question
up vote 6 down vote accepted

"Automated" Oracle Java Downloads (JRE/JDK 6/7 and others...)

You will need sqlite3 installed; it's a tiny package, use sudo apt-get install sqlite3 if you need to.

  1. Open Firefox, go to the Java downloads page for the version/variant you need, and click on the Accept License Agreement radio button.

    enter image description here

  2. Open a terminal, and paste this to extract the necessary Oracle session cookies from the Firefox SQLite cookie database into a cookies format text file wget can use (source for script):

    echo ".mode tabs
    select host, case when host glob '.*' then 'TRUE' else 'FALSE' end, path,
    case when isSecure then 'TRUE' else 'FALSE' end, expiry, name, value
    from moz_cookies;" | sqlite3 ~/.mozilla/firefox/*.default/cookies.sqlite
    | grep -i oracle > /tmp/oracle-cookies.txt
  3. Now use wget to download with those session cookies:

    wget --load-cookies=/tmp/oracle-cookies.txt wget
  4. Notes:

    • You can use these cookies for any Oracle download as long as it comes from the otn-pub directory
    • You can paste the script in to a .sh file for easier use
    • The cookies are not associated with IP, so for a headless/CLI server, simply SCP or transfer the cookies file and you can download from any computer (but there is a 30-minute timeout on the cookie, so beware)
    • Related: How do I use wget/curl to download from a site I am logged into?
share|improve this answer
Is it 100% legal? – Tachyons Aug 1 '12 at 23:22
@tachyons Yes, you do have to open a browser on some computer and click on "Accept License Agreement" before you can do any of this... – izx Aug 1 '12 at 23:24
Cool trick, but any idea if it still works? I keep trying it but it only downloads an html page content that says "Sorry! In order to download products from the OTN you must agree to the OTN license terms". Either I'm doing it wrong or Oracle got wise to this... – Kurtosis Aug 29 '12 at 0:36
You can always just past that url into the browser as well :) – Dreamwalker Jul 1 at 12:03

There is a similar question on stackoverflow: How to automate download and instalation of Java JDK on Linux?

The answer using wget is:

wget --no-cookies --header "Cookie:" ""

The last argument is the url to download from. Different java version archives differ not only in version, but extension too.

share|improve this answer
No longer works. – Roger Dahl Jan 14 at 16:40

As an addition to izx answer, there is a chrome plugin you can use to export your cookies, so you do not have to use sqlite.

share|improve this answer
@izx's answer is great. But I much prefer pushy's suggestion of using "Cookie.txt export" to get the cookie contents (corresponding to step 2 of izx's answer) rather than using sqlite3. – mdahlman Aug 6 '13 at 21:34

A quick way with out cookies:

  • Start the download in your browser
  • Pause the download
  • Copy the url being used for the download
  • Use the url with wget: wget --no-check-certificate URL_FOR_DOWNLOAD

The URL is probably only valid for a limited amount of time (often 30minutes).

share|improve this answer

Actually, just get the content given by the chrome extension mentioned by pushy in a file on your linux. Then copy the dl adresse from oracle page and add it to your wget command. For example, to dl Oracle Database 11g Release 2 (

vagrant@vagrant-ubuntu-trusty-64:~/download$ wget -x --load-cookies cookies.txt

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.