• I can't use openjdk because it doesn't have native .jpg support.
  • I can't use sudo apt-get install sun-java6-jre sun-java6-plugin any more because apparently those have been pulled.
  • JRE version 7 works, but the only way I've found to get it is to accept the terms of service ON THEIR WEBSITE and I need to install Java ON MY SERVER where I only have command line access.

Throw me a fricken bone here Java!


It just dawned on me that I can download the .tar.gz on my desktop computer and scp it over to the server. Who put me in charge?!


Just download the tarball and then install it. On a Debian or Ubuntu system I would install it to /usr/lib/jvm/XXX and run update-alternatives:

cd /usr/lib/jvm
tar -xzf /path/to/java_tarball.tar.gz
update-alternatives --remove-all java
update-alternatives --remove-all javac
update-alternatives --install /usr/bin/java java /usr/lib/jvm/YOURJAVA/bin/java 1000
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/YOURJAVA/bin/javac 1000

You don't have to run the --remove-all part, in that case make sure the number "1000" is higher than the current one it's set to, which can be found with:

update-alternatives --display java (or javac)
| improve this answer | |

An easy way to install the Oracle JDK and the Oracle JRE and receive software updates of those packages is by add a repository with installation packages to our system with those instructions:

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo update-java-alternatives --set java-8-oracle



| improve this answer | |

Actually it is possible to accept license and download the tar from command line, all in one step.

You can pass a cookie to the server via wget in this way:

wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-i586.tar.gz

After that you can just install the tar by extracting and updating alternatives as in @aseq answer above.

Note: Make sure that accepting the license in this way is legal, before using this method.

Note: Name of cookie and its value might change in time.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.