1. View Fedora's existing Java environment version
OPENJDK version "1.8.0_25" OPENJDK Runtime Environment (build 1.8.0_25-b18) openjdk 64-bit Server VM (build 25.25-b02, mixed Mode
2. Download Sun's latest jdk RPM version
A.: http://www.oracle.com/technetwork/java/javase/downloads/index.html
The latest version I downloaded here is jdk-8u25-linux-x64.rpm [Fedora 64-bit system, please select the version for your system]
B. Installation:
Rpm-iv jdk-8u25-linux-x64.rpm
Error: XXX appears xxx is not in the sudoers file, this matter will be reported
Solve:
Visudo
#visudo can modify the edit/etc/sudoers to join with the following own user xxx sudo to perform the appropriate permissions
XXX all= (All) all
Re-RPM-IV jdk-8u25-linux-x64.rpm successfully installed!
3. Configure Java Environment variables
vim
/etc/profile
# 添加以下内容
JAVA_HOME=
/usr/local/java
PATH=$JAVA_HOME
/bin
:$PATH
CLASSPATH=.:$JAVA_HOME
/lib/dt
.jar:$JAVA_HOME
/lib/tools
.jar
export
JAVA_HOME
export
PATH
export
CLASSPATH
# 退出编辑模式,回到命令行,运行
source
/etc/profile#再次运行java-version View information Display java-version# show Java version "1.8.0_25"
Java (TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot (TM) 64-bit Server VM (build 25.25-b02, Mixed mode) #还没完, don't know why every time I open a new terminal and then go back and then configure the default javasudo/usr/s directly Bin/alternatives--config Java
[sudo] password for QKL:
There are a total of 2 programs that provide "Java".
Options command
-----------------------------------------------
* 1/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.25-4.b18.fc21.x86_64/jre/bin/java
+ 2/usr/java/jdk1.8.0_25/bin/java
Press Enter to leave the current option [+], or type the option number:
#根据我这边的显示新安装的java JDK above Enter number 2 OK
Fedora 21 Configuration JDK environment Replacement OPENJDK