Oracle Java for Linux
Contents
JRE
JRE on 32-bit and 64-bit Debian / Ubuntu / Mint Linux operating systems.
End users looking for java to run software are looking for JRE. OpenJRE / OpenJDK is an alternative to Oracle Java that is the default on packaged linux systems such as Ubuntu / Kbuntu / Mint.
Are you 32 or 64 bit? Type:
uname -m
Have you downloaded Oracle Java? as of TOR you could find it [ here ] and the file you need is/was called [ jre-8u181-linux-x64.tar.gz ]
note: jre-8u181-linux-x64.tar.gz for 64 bit, jre-8u181-linux-i586.tar.gz 32 bit, and adjust the version number or build number for what is current at the time you are reading this. (as of 2018 there is a jre 10, however, many software recommends jre 8). Companies like Oracle tend to move things around on their website unnecessarily often, so more than a week after TOR that link is probably defunct.
Adjust any version numbers to accommodate your system, otherwise instructions assume currents as of TOR: typically OpenJDK version 7. To REMOVE OpenJDK and install Oracle Java JRE do the following.
1. remove OpenJDK
sudo apt-get autoremove openjdk-7-jre
2. confirm complete removal (other instructions online do not accomplish this ie WikiHow)
sudo java -version
You should see the error: No such file or directory <- that is good!
3. make a home
sudo mkdir /usr/local/java
4. have the oracle installation file ready in the path /usr/local/java
5. set permissions
sudo chmod a+x jre-8u181-linux-x64.tar.gz
6. decompress archive
sudo tar xzvf jre-8u181-linux-x64.tar.gz
7. as an alternative to setting a bunch of path env variables, just use a symlink
sudo ln -s /usr/local/java/jre1.8.0_181/bin/java /usr/bin/java
Trying to Keep Them Both: Newer Distributions Based on Debian
Update: If you are running a modern Debian variant such as Ubuntu or Mint you should not go hacking away at symlinks from the command line. Instead safely use "update-alternatives" which is explained on the Default Java on Mint Linux page. This applies to Linux versions such as Mint 19.2 as an example (for time release reference).
- Download the version you wish to run, for our example Oracle 8 from the file jre-8u181-linux-x64.tar.gz
- Extract jre-8u181-linux-x64.tar.gz to /usr/local - you end up the the java binary in the path: /usr/local/jre1.8.0_181/bin
- Add the java to the update-alternatives link group - sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/jre1.8.0_181/bin/java" 8
- Then run update-alternatives
Examples:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/jre1.8.0_181/bin/java" 8 update-alternatives java -version java -jar ./program.jar
Don't have "update-alternatives" as a utility in your distribution? Read on...
Trying to Keep Them Both: Other and older Distributions
Warning! This (the process below) is problematic and requires more than doing the symlinks, however, here ya go... If you didnt delete OpenJDK then when you type:
file /usr/bin/java /usr/bin/java: symbolic link to /etc/alternatives/java
Do this:
rm /usr/bin/java ln -s /usr/local/java/jre1.8.0_181/bin/java /usr/bin/java
See also: Default Java on Mint Linux
other guides
Here are some other installation guides that differ however accomplish the same task
- https://www.wikihow.com/Install-Oracle-Java-JRE-on-Ubuntu-Linux
- https://help.ubuntu.com/community/Java
Some Related Pages
- Oracle Java for Linux
- Default Java on Mint Linux
- IBM Java Runtime Environment
- Java Quick Starter