0

Oracle JRE

At the above link, I would like to download jre-8u211-windows-i586.tar.gz and jre-8u211-windows-x64.tar.gz via the windows command prompt or batch file. This is an interesting challenge for the batch expert, not sure how to deal with Oracles authentication either.

This is part of a batch script we have for reducing the size of our JRE distribution.

RKRK
  • 1,284
  • 5
  • 14
  • 18
gunslingor
  • 1,358
  • 12
  • 34
  • That would be bypassing the intent of their license agreement, which is to have someone manually click "I accept" when downloading it. –  Apr 18 '19 at 15:04
  • When you are on a linux terminal it is really hard to click manually on the accept radio button. – Sascha Apr 18 '19 at 15:12
  • 2
    Highly relevant: https://stackoverflow.com/questions/10268583/downloading-java-jdk-on-linux-via-wget-is-shown-license-page-instead – VGR Apr 18 '19 at 15:18

1 Answers1

2

As a starting point I can provide a Shell download script which looks for the newest Java 8 Server JRE:

downloadPage=$(wget -q -O- http://www.oracle.com/technetwork/java/javase/downloads/index.html | grep -o -E 'server-jre8-downloads-[^"]+.html')
echo Prüfe ${downloadPage} auf Download-Link
#downloadUrl=$(wget -q -O- http://www.oracle.com/technetwork/java/javase/downloads/${downloadPage} | grep -o -E "http.+/server-jre.+linux-x64.tar.gz" | head -1)
downloadUrl=$(wget -q -O- http://www.oracle.com/technetwork/java/javase/downloads/${downloadPage} | grep -o -E 'http[^"]+/server-jre[^"]+linux-x64.tar.gz' | head -1)

echo Download von ${downloadUrl}
downloadFileName=$(echo ${downloadUrl} | cut -d'/' -f9)
echo Dateiname ${downloadFileName}
version=$(echo ${downloadFileName} | cut -d'-' -f3 | cut -d'u' -f2)
echo Update-Version ${version}

tarDir=/usr/local/src

wget -P $tarDir --no-check-certificate --header='Cookie: oraclelicense=accept-securebackup-cookie' ${downloadUrl}
Sascha
  • 1,320
  • 10
  • 16
  • I'm going to mark this as the accepted answer even though it's a little different approach that uses powershell... there is enough info in this and the previous comments to form a solution with. Thank you everyone, more than enough to get me moving in the right direction. – gunslingor Apr 23 '19 at 13:28