简体   繁体   English

如何在Mac中降级Java版本

[英]How to downgrade the java version in mac

My current java version details:- 我当前的Java版本详细信息:-

在此处输入图片说明

I followed the steps which are mentioned in the official java web site . 我按照官方Java网站中提到的步骤进行操作。 Below are related steps screenshot:- 以下是相关步骤的屏幕截图:-

在此处输入图片说明

After executing these commands, the java version remains the same. 执行完这些命令后,Java版本保持不变。 I want to downgrade the java version, because I am facing issue with hockey app plugin in jenkins . 我想降级Java版本,因为我在jenkins中遇到曲棍球应用程序插件问题。

  • Do I need to restart my system? 我需要重启系统吗?
  • Do I need to perform other steps? 我是否需要执行其他步骤? If yes, what are those? 如果是,那是什么?

First run /usr/libexec/java_home -V which will output something like the following: 首先运行/ usr / libexec / java_home -V,它将输出如下内容:

Matching Java Virtual Machines (3):
1.8.0_05, x86_64:   "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home
1.6.0_65-b14-462, x86_64:   "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
1.6.0_65-b14-462, i386: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home

Pick the version you want to be the default (1.6.0_65-b14-462 for arguments sake) then: 选择您想要作为默认版本的版本(出于参数考虑,版本为1.6.0_65-b14-462),然后:

export JAVA_HOME=`/usr/libexec/java_home -v 1.6.0_65-b14-462` or you can specify just the major version, if it's unique, like 导出JAVA_HOME =`/ usr / libexec / java_home -v 1.6.0_65-b14-462`或者您可以仅指定主要版本(如果唯一),例如

export JAVA_HOME=`/usr/libexec/java_home -v 1.8` Now when you run java -version you will see: 导出JAVA_HOME =`/ usr / libexec / java_home -v 1.8`现在,当您运行java -version时,您将看到:

java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

Just add the export JAVA_HOME… line to your shell's init file. 只需将export JAVA_HOME…行添加到Shell的init文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM