Install Java runtime JRE in Ubuntu 16.04

Recently, we need to use Vuze software to download things in the Ubuntu system. When we run the program, we are prompted that there is a lack of JRE environment. In order to solve this problem, we have found many solutions on the Internet. Under normal conditions, run the following command to install:

sudo apt-get install openjdk-7-jre

However, after the command is executed, the error “package ‘openjdk-7-jre’ has no installation candidate” is prompted, as shown in the figure below

This problem should be caused by the current data source does not contain JRE, but it is also troublesome to find an available data source to add. In fact, you can directly download the tar.gz package corresponding to JRE from Oracle’s Java official website. The command is as follows:

wget http://javadl.oracle.com/webapps/download/AutoDL?BundleId=225345_090f390dda5b47b9b721c7dfaa008135

Unzip the downloaded file, I put it directly under the home directory, and change the unzipped folder name to JRE, which is ~/JRE . Then, set the environment variables by modifying the /etc/profile file. The command is as follows:

sudo gedit /etc/profile

Add the following lines at the end of the file:

export JAVA_HOME=~/jre
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=$JAVA_HOME/lib

Save, exit. Enter the following command to make it work. (you may need to restart the system here)

sudo source /etc/profile

Check the Java version,

java -version

If the version information is displayed successfully, the environment is installed successfully

When executing the source command, the prompt "command not found" is also dizzy. The reason mentioned on the Internet is due to the modification of the path environment variable. You need to re export the environment variable through the following command:

export PATH=/bin:/usr/bin:/usr/local/bin

So far, the problem has been solved.

Read More: