OpenJDK 和 update-alternatives 命令

huangapple go评论73阅读模式
英文:

OpenJDK and update-alternatives command

问题

在Ubuntu 20.04 LTS上,我已执行:

sudo apt-get install openjdk-{8,11,14}-{jdk,source,doc}

现在我经常使用以下命令:

sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javadoc

...也许还有其他一些命令,但是当我输入以下命令:

ls -l /etc/alternatives/*j*

我仍然发现许多与Java相关的命令未受上述一系列update-alternatives命令的影响。

完整的update-alternatives命令列表是什么?这些命令将把每个与Java相关的命令都更改为指定的Java版本。

英文:

On Ubuntu 20.04 LTS, I've done:

sudo apt-get install openjdk-{8,11,14}-{jdk,source,doc}

Now I often use the commands

sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javadoc

...and maybe a few others, but when I type this command:

ls -l /etc/alternatives/*j*

I still find many Java-related commands which have not been affected by the above sequence of update-alternatives commands.

What is the full list of update-alternatives commands that will change every single Java-related command to a specified Java version?

答案1

得分: 2

这可能对许多软件都是一个问题,但对于Ubuntu上的Java来说,这是一个特定的问题。幸运的是,有一个特定的解决方案,一个名为:update-java-alternatives 的程序。

我刚刚这样使用它:

sudo update-java-alternatives -s java-1.14.0-openjdk-amd64

它已经更改了大多数与Java相关的工具的替代项。

关于这个主题的更多评论可以在askubuntu上找到,针对一个类似的问题。这问题也与之相关,并且有一个答案链接到同一个程序。

英文:

While this can be a problem for many software, this is a specific problem for Java on Ubuntu. Fortunately there is a specific solution, a program, call:

update-java-alternatives

I have just use it the following way:

sudo update-java-alternatives -s java-1.14.0-openjdk-amd64

It have change the alternatives of most of the Java related tools.

More comment on this subject can be found on askubuntu for a similar question. This question is also related, and an answer link to the same program.

huangapple
  • 本文由 发表于 2020年5月29日 19:10:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/62084574.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定