Manually downloading Java For Use With Webupd8’s apt-get Package
Category : How-to
Oracle Java is one of the biggest problems in life. That’s just a fact. Half of it is the fact that you have to download it directly from Oracle each time, quarter of it is the almost daily updates (compounded by the first problem), and the remainder is dealing with the fact that the first problem is there by design.
Thankfully the boys and girls over at Webupd8 have created and maintain an apt-get deployed version of Oracle Java that handles initial setup and future updates. The apt package doesn’t actually contain the Oracle Java binaries, because that’s against Oracle’s TOC’s, but it contains a script that downloads it for you – all behind the scenes.
Sometimes Corporate networks block access to Oracle’s download servers and therefore block access to you installing Oracle Java by this method. Except…
You can manually download the JDK from Oracle and copy it to the required machine in the apt cache directory. When you then run the apt-get command the installer will realise that the tar.gz containing the Java binaries is available and won’t need to download it. You’ll still need the internet to download the apt package, but you won’t need to access oracle.com.
First off, make the relevant cache directory for use with your version of java. This example assumes Java 8.
Copy the latest version of Java into the above cache directory. This assumes that the download is in your current directory and is Java version 8 update 91.
cp jdk-8u91-linux-x64.tar.gz /var/cache/oracle-jdk8-installer/jdk-8u91-linux-x64.tar.gz
Finally install the required version of Java.
apt-get install oracle-java8-set-default
You’ll see the message Installing from local file as part of the installation indicating the installer hasn’t needed to download the Java binaries from Oracle.
Reading package lists... Done Building dependency tree Reading state information... Done oracle-java8-set-default is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded. 2 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-java8-installer (8u92+8u91arm-2~really8u91~webupd8~0) ... Installing from local file /var/cache/oracle-jdk8-installer/jdk-8u91-linux-x64.tar.gz
Leave a Reply