Can't change destination of symbolic link

Solution 1:

To create a symbolic link to a directory, use the 'n' option:

ln -sfn DESTINATION_DIRECTORY LINK_NAME
  • DESTINATION_DIRECTORY is the name of the link target;
  • LINK_NAME is the name of the link.
  • The f option means to replace the existing link (ie, delete it first).

The n option is a bit complicated. I believe your command may have created a link to jdk1.7.0_07 inside the directory jdk1.7.0_04, via the link oracle-jdk-7 rather than replacing the link. If so, you should delete the link to avoid confusion.