安装java时update-alternatives返回无效选项

安装java时update-alternatives返回无效选项

我正在尝试安装javadebian jessie 8.8

sudo update-alternatives --install /usr/bin/java java /usr/local/PeykAsa/jdk1.7.0/bin/java 315

我得到:

update-alternatives: unknown option `--install /usr/bin/java'
Use 'update-alternatives --help' for program usage information.

我认为该命令没有遗漏什么,因为手册页man update-alternatives这样说:

   --install link name path priority [--slave link name path]...
          Add  a  group  of  alternatives  to  the system.  link is the generic name for the master link, name is the name of its symlink in the alternatives directory, and path is the alternative being
          introduced for the master link.  The arguments after --slave are the generic name, symlink name in the alternatives directory and the alternative path for a slave link.  Zero or  more  --slave
          options,  each followed by three arguments, may be specified. Note that the master alternative must exist or the call will fail. However if a slave alternative doesn't exist, the corresponding
          slave alternative link will simply not be installed (a warning will still be displayed). If some real file is installed where an alternative link has to be installed, it is kept unless --force
          is used.

          If  the  alternative  name  specified  exists already in the alternatives system's records, the information supplied will be added as a new set of alternatives for the group.  Otherwise, a new
          group, set to automatic mode, will be added with this information.  If the group is in automatic mode, and the newly added alternatives' priority is higher than any  other  installed  alterna‐
          tives for this group, the symlinks will be updated to point to the newly added alternatives.

我尝试过--force,得到了相同的输出。我从未在debian、 任何版本(例如 7、6、8.2、8.8 等)上遇到过此类问题。

答案1

如果您从某处复制粘贴该命令,您可能会得到一个 Unicode 字符而不是 ASCII 字符(用破折号代替-,或者用不间断空格代替空格,等等)。但是,如果它是破折号或类似的符号,则它不会被视为选项参数(而是被视为无法识别的选项)。由于 是--install /usr/bin/java作为错误中的一个参数出现的,因此之间的空格可能不是 ASCII 空格,而是一个统一码

相关内容