[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 672
  • Last Modified:

Linux Question

I am trying to download the JDK6 package from a URL and install it using the command line.  I am using wget, it find the url but how do I get it to download the correct package?

Here is the site I am trying to get the installation file from:

6 Solutions
You can't use wget. Oracle hides the download behind a Javascript link because that forces you to accept the license agreement before it can be downloaded.

If you're trying to automate an installation process, you'll have to download the JDK manually first, then launch it within your script from a local drive, ftp server, or file server.
Why even download it from Oracle's site? Most distributions include it in their repositories and you'd only have to install it directly via your distro's package manager.
@rindi, a download would be needed if the OP needs a newer (or older) JDK than his distro provides.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

But you risk making your system unstable by installing software that isn't supported. Not using your repository to install software should only ever be your very last resort.
@rindi: Oracle supply rpms for Linux; I agree that the Linux distros updates should be the "best" version if they're updated in a timely fashion, but I've found subtle differences between the SUSE/IBM release of Oracles latest fix, and Oracles own rpm.

@Jack_son_: From an answer I posted at http://stackoverflow.com/questions/10268583/how-to-automate-download-and-installation-of-java-jdk-on-linux :

Oracle provide persistent links to the latest updates of each Java version as documented at https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=397248601136938&id=1414485.1 - though you need to create/log in to an Oracle Support account. *Otherwise you can only access the last "public" update of each Java version, e.g. 1.6_u45 (Mar 2013; Latest update is u65, Oct 2013)*

Once you know the persistent link, you should be able to resolve it to the real download; The following works for me, though I don't yet know if the "aru" reference changes.


echo "Get real URL from the persistent link"

wget -o getrealurl.out --no-cookies --no-check-certificate --user=$ME \
--password=$PW --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" \

wait    # wget appears to go into background, so "wait" waits
        # until all background processes complete

REALURL=`grep "^--" getrealurl.out |tail -1 |sed -e 's/.*http/http/'`
#These last steps must be done quickly, as the REALURL seems to have a short-lived
#cookie on it and I've had no success with  --keep-session-cookies etc.
Seth SimmonsSr. Systems AdministratorCommented:
if you are using a linux system with a gui, download through the browser there and install else download on a windows system and transfer the file through filezilla
simpler than trying to get wget to work with oracle sso sessions which may not be possible
I assume your distribution comes with supported version of OpenJDK
For JDK 6 oracle offers only old and insecure version, which you nest avoid.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now