Java – Install Oracle Java JRE 7 on Ubuntu with just the command line

installationjavaoracle

  • 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!

Edit

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?!

Best Answer

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)
Related Topic