[Solved] ln: failed to create symbolic link ‘/usr/bin/java’: File exists

Install Java environment in CentOS, add soft link times: ln: failed to create symbolic link ‘/ usr/bin/Java’: file exists

[root@iZbp12f9404um3f6avsm29Z /]# ln -s /usr/local/java/jdk1.8.0_291/bin/java /usr/bin/java
ln: failed to create symbolic link ‘/usr/bin/java’: File exists

Failed to create symbolic link, file exists.

-s   The meaning of the command is to add symbolic links to play the role of a link

resolvent

[root@iZbp12f9404um3f6avsm29Z /]# ln -sf /usr/local/java/jdk1.8.0_291/bin/java /usr/bin/java
[root@iZbp12f9404um3f6avsm29Z /]# java -version
java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)

Modify the – s command to – SF command- The f command means to enforce, which means to create if it does not exist and to override if it does exist

So far, the creation of soft connection is completed

Read More: