I updated my 12.04 server with latest packages among them was an update to java 1.8u20.
Now I found out that my application is not running correctly with java 1.8u20. Now I looking for a way to downgrade Java to previous version or 1.8u5 in my case.
I tried to install a specific version
apt-get install oracle-java8-installer=8u5-1~webupd8~3
apt-get install oracle-java8-installer=8u5-1~webupd8
apt-get install oracle-java8-installer=8u5-1
E: Version 'XXX' for 'oracle-java8-installer' was not foundBut the version I had from doesn't seem to work.
My Question is, how can I install a specific Version of java 8?
2 Answers
If you need install specific version of Java on any distro, you must do it manually, but it is easy.
First you need which architecture OS you have.
uname -aThe x86_64 is 64bit and ix86 (x can be 3 or 6).
If you have 64 bit OS (in present it is probably) follow this steps. -> Open the terminal.
1) Create directory and go to /opt/jdk
mkdir /opt/jdk
cd /opt2) Download Java package (if someone need another version only need change version and build in link)
wget --header "Cookie: oraclelicense=accept-securebackup-cookie" 3) Optional (if you are not logged as root you need):
sudo su4) Untar the package:
tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk5) Set Oracle's Java as default:
update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_05/bin/java 100
update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_05/bin/javac 1006) Check Java version if it os ok
java -versionI follow this part of this tutorial, but this method is for anyone distro. For example I mainly used this for installation on servers where we nedd specific version of Java 7.
3I followed the steps for the answer and it is almost perfect.
update-alternatives does not make sure you have any necessary dependencies- it is just an official way to track softlinks from system folders to main exectubles for things like java and javac.
On my light version of Ubuntu 18.04 I was missing some x libraries. I was able to add those to get the desired result:
sudo apt-get install -y libxext-dev libxrender-dev libxtst-devI was running a java application that uses AWT / Screen objects. I was getting a crash with a NullPointerException in Main. Not very informative, but I had seen the same problem when my $DISPLAY was not set correctly to an X system ready to accept the java draw commands. Adding the x libraries will give you a fuller range of capabilities for the java you install.