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:

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Jack_son_Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ThomasMcA2Commented:
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.
0
rindiCommented:
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.
0
ThomasMcA2Commented:
@rindi, a download would be needed if the OP needs a newer (or older) JDK than his distro provides.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

rindiCommented:
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.
0
tfewsterCommented:
@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.

ME=<myOracleID>
PW=<myOraclePW>
PATCH_FILE=p13079846_17000_Linux-x86-64.zip

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" \
https://updates.oracle.com/Orion/Services/download/$PATCH_FILE?aru=16884382&\
patch_file=$PATCH_FILE

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/'`
wget -O $PATCH_FILE $REALURL
#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.
0
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
0
gheistCommented:
I assume your distribution comes with supported version of OpenJDK
For JDK 6 oracle offers only old and insecure version, which you nest avoid.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.