I have an ubuntu system and I want to replace my openjdk with oracle-jdk.
However if I remove my open-jdk and then install oracle-jdk, when I try to install some packages they want to install openjdk and I don't want this.
Is there any way to install those packages on top of oracle-jdk? One of those packages is freemind.
Best Answer
You can completely remove the
OpenJDK
and fresh InstallOracle Java JDK
by following these steps:Remove
OpenJDK
completely by this command:Download the
Oracle Java JDK
here.Note: download appropriate file, for example if your system is x64 Ubuntu (i.e, Debian) the download file is named like this:
jdk-8u51-linux-x64.tar.gz
To find which version is your OS, check here
Create a folder named
java
in/usr/local/
by this command:Copy the Downloaded file in the directory
/usr/local/java
. To do this,cd
into directory where downloaded file is located and use this command for copying that file to/usr/local/java/
:CD into
/usr/local/java/
directory and extract that copied file by using this command:After extraction you must see a folder named
jdk1.8.0_51
.Update
PATH
file by opening/etc/profile
file by the commandsudo nano /etc/profile
and paste the following at the end of the file:Save and exit.
Tell the system that the new Oracle Java version is available by the following commands:
Make Oracle Java JDK as default by this following commands:
Reload sytem wide PATH /etc/profile by this command:
Reboot your system.
Check Java JDK version by
java -version
command . If installation is succesful, it will display like the following:That's it!
Note: We Assumed that the downloaded file is named
jdk-8u51-linux-x64.tar.gz
and used this name in all the commands used in steps 2, 4 and 5. It may depends on the type of O.S, processor type (i.e., 32bit or 64bit)