Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

简单管理多版本 JDK #7

Open
kingcos opened this issue May 5, 2018 · 2 comments
Open

简单管理多版本 JDK #7

kingcos opened this issue May 5, 2018 · 2 comments
Assignees
Labels
[Tips] 即提示

Comments

@kingcos
Copy link
Owner

kingcos commented May 5, 2018

Platform Notes
macOS 10.13.4 JDK 8 & 9

Solution

  • 安装 JDK 8 & 9(其他版本同理)
  • vim ~/.zsh_rc(这里使用的是 BashShell,其他 Shell 自行替换)
  • 文末追加:
# Java
export JAVA_8_HOME=$(/usr/libexec/java_home -v1.8)
export JAVA_9_HOME=$(/usr/libexec/java_home -v9)

# Default for Java 8
export JAVA_HOME=$JAVA_8_HOME

alias java9='export JAVA_HOME=$JAVA_9_HOME'
alias java8='export JAVA_HOME=$JAVA_8_HOME'

.zsh_rc

  • 切换版本:java8 / java9
  • 检查版本:java -version

Terminal

Extension

@kingcos kingcos added the [Tips] 即提示 label May 5, 2018
@kingcos kingcos self-assigned this May 5, 2018
@ghost
Copy link

ghost commented May 12, 2019

推荐使用sdkman哈

@kingcos
Copy link
Owner Author

kingcos commented May 15, 2019

推荐使用sdkman哈

赞,很棒地解决了痛点

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Tips] 即提示
Projects
None yet
Development

No branches or pull requests

1 participant