可以在Ubuntu中将JDK 1.8.0_252更改为JDK 1.8.0_251吗?

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

Is it possible to change jdk 1.8.0_252 to jdk 1.8.0_251 in Ubuntu?

问题

我有一个项目,我正试图使用jdk 1.8.0_252来运行它,但是我在编译时遇到问题,而另一方面,在jdk 1.8.0_251中它运行良好。

有人可以帮忙更改jdk吗?

英文:

I have one project which I am trying to run using jdk 1.8.0_252 but I am facing problems in compilation so On other side Its working well in jdk 1.8.0_251.

Can anyone help to change jdk?

答案1

得分: 0

如果您想使用特定版本的JAVA [JDK],您总是可以安装它,并将JAVA_HOME指向新安装的版本。您可以在系统中安装多个版本的java。您的环境变量应该指向您想要使用的Java版本。

您需要编辑bashrc并添加以下内容:

export JAVA_HOME=/usr/java/jdk1.8.0_251
export PATH=${PATH}:${JAVA_HOME}/bin

验证您的Java版本的安装路径(例如:/usr/java/jdk1.8.0_251)。

重新启动bash或启动新的shell。

英文:

If you want to use a specific version of JAVA [JDK ] you can always install install it and point the JAVA_HOME to the newly installed version. You can have multiple versions of java installed in your system. Your environment variable should point to the Java version that you want to use.

You need to edit bashrc and add the below :

export JAVA_HOME=/usr/java/jdk1.8.0_251
export PATH=${PATH}:${JAVA_HOME}/bin

Verify the installation path for your Java version (example : /usr/java/jdk1.8.0_251).

Restart your bash or start a new shell.

答案2

得分: 0

sudo update-alternatives --config java

请查看[这篇博客][1]
对我真的很有用。

  [1]: https://aboullaite.me/switching-between-java-versions-on-ubuntu-linux/
英文:
sudo update-alternatives --config java

Please have a look on this blog
It really works for me.

huangapple
  • 本文由 发表于 2020年7月24日 00:16:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/63058709.html
匿名

发表评论

匿名网友

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

确定