1. Upload the downloaded Java package, such as http://download.oracle.com/otn-pub/java/jdk/8u77-b03/jre-8u77-linux-x64.rpm, the directory can be defined by itself, such as/root/ elasticsearch/
2. Run the Install command:
Yum install/root/elasticsearch/jre-8u77-linux-x64.rpm
If the prompt is not successfully installed, ls–al/root/elasticsearch/jre-8u77-linux-x64.rpm see if the current file has execute permissions and if not, run
chmod +x/root/elasticsearch/jre-8u77-linux-x64.rpm, adding Execute permissions
After the installation is complete, if you are unsure whether the installation was successful, you can perform the following view commands:
Find/–maxdepth–8–name jre1.8*
Typically installed by default under/usr/java/
3. Modify the Java link
(Method 1, directly modify the symbolic link)
First look at the current Java version of Java–version, such as 1.7.0_91
Start to modify the link: Execute in turn;
Alternatives--install/usr/bin/java Java/usr/java/jre1.8.0_77/bin/java 300
Alternatives--config Java
View the Java version at this time:
Java–version, became 1.8.0_77.
(Method 2, modify the Java Path environment variable)
After installation, confirm the current installation path (not clear, according to the version you installed check execution:find/–maxdepth–8–name jre1.8*)
Add the current path to the $path variable, as the path I installed is/usr/java/jre1.8.0_77/bin
Edit the/etc/profile file using VI, vi/etc/profile/
Add at end of line:
Path=/usr/java/jre1.8.0_77/bin: $PATH;
To see if a variable has been added:
Echo $PATH
Verifying the Java version:
Java-version
Reference:
Http://www.cnblogs.com/kreo/p/4308651.html
Changing the Java environment under CENTOS7