1

ive taken these steps to try and install Java 8 on my 12.04 LTS server.

http://www.webupd8.org/2012/09/install-oracle-java-8-in-ubuntu-via-ppa.html

i had an error when running trying to intall the java installer so i tried:

Tip: if you're behind a firewall / router that blocks some of the 
redirects required to download the Oracle Java archive, you can download 
the JDK tar.gz archive manually and place it under /var/cache/oracle-
jdk8-installer - then, installing the "oracle-java8-installer" package 
will use the local archive instead of trying it to download it itself.

but when running apt-get install oracle-java8-installer again, it does not use the cached file, it tries to download it again but fails, actually it really doesnt seem to fail the download, the download actually happens, and the installer appears in the cache directory. heres the error output:

proxy sent request, awaiting response... 404 OK
2015-07-24 08:36:25 ERROR 404: OK.

download failed
Oracle jdk 8 not installed
dpkg error processing oracle-java8-installer (--configuer):
subprocess installed poit-installation script returned error exit status 1
errors were encountered while processing:
oracle-java8-installer
E: sub-process /usr/bin/dpkg returned an error code (1)

strangely, even though it said there was an error, the package exists in the cahce directory, to be safe i downloaded the tar manually, then i tried to follow the second answer from:

Install .tar.gz and .tar files?

runnning tar -xvvf [filename.tar.gz] works and seems to extract everything to a folder

after that im not sure how to use ./configure, running it as a command doesnt work.

can anyone guide me through the installation of Java8 on Ubuntu 12.04 LTS!

1 Answers1

1

Installing JAVA JDK

Here, you will need sudo privileges:

sudo su

The /opt directory is reserved for all the software and add-on packages that are not part of the default installation. Create a directory for your JDK installation:

mkdir /opt/jdk

and extract java into the /opt/jdk directory:

tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk

Verify that the file has been extracted into the /opt/jdk directory.

ls /opt/jdk

Setting Oracle JDK as the default JVM

In our case, the java executable is located under /opt/jdk/jdk1.8.0_05/bin/java . To set it as the default JVM in your machine run:

update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_05/bin/java 100

and

update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_05/bin/javac 100

Verifying YourInstallation

javac

  • hey thanks, everything seemed to work until i ran javac, it told me that i wasnt using it properly and needed to add options and such, this is normal right? i should have also mentioned that i already have Java6 installed, after running your commands and then running 'java -version' it tells me that java6 is still installed, which is to be expected as i haven't uninstalled it or changed the path variables. If i change the path vars to suit the new java8 intallation will java8 take over? if so, how do i change the path vars! thanks – ThriceGood Jul 24 '15 at 10:05
  • 1
    @ThriceGood run sudo update-alternatives --config java this will give you option to select between java6 and java8 – Jaysheel Utekar Jul 24 '15 at 10:20
  • excellent, that worked perfectly, i thank you! – ThriceGood Jul 24 '15 at 10:59