728x90
현재 설치된 JDK 버전 목록 확인
/usr/libexec/java_home -V
아래 스크립트를 복붙!
javahome_usage() {
echo "javahome - switch to different JDK version"
echo "Usage: javahome [-h] [-v VERSION]"
echo echo " -h : display usage"
echo " -v : specific JDK version to switch"
echo echo "Examples: "
echo "># javahome -v 1.8 : switches to JDK8"
echo "># javahome -v 11 : switches to JDK11"
echo "># javahome -v 16 : switches to JDK16"
echo "># javahome -v 17 : switches to JDK17"
echo "># javahome : display all installed JDK and display current JDK"
}
jhome () {
if [ "$1" = "-h" ] ; then
jhome_usage
fi
if [ "$#" -eq 0 ] ; then
/usr/libexec/java_home -V
fi
if [ "$#" -eq 2 ] && [ "$1" = "-v" ] ; then
export JAVA_HOME=`/usr/libexec/java_home $@`
echo "Setting JAVA_HOME:" $JAVA_HOME
echo
echo "Added JAVA_HOME/bin to PATH"
PATH=$PATH:$JAVA_HOME/bin
echo $PATH
echo
java -version
fi
}14
아래와같이 출력된다
Setting JAVA_HOME: /Library/Java/JavaVirtualMachines/adoptopenjdk-14.jdk/Contents/Home
Added JAVA_HOME/bin to PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Java/JavaVirtualMachines/adoptopenjdk-14.jdk/Contents/Home/bin:/Library/Java/JavaVirtualMachines/adoptopenjdk-14.jdk/Contents/Home/bin
openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.2+12)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.2+12, mixed mode, sharing)
'OS > MacOS' 카테고리의 다른 글
맥북 덮개 열기& 닫기 전원/소리 on&off (0) | 2023.04.17 |
---|---|
한글 파일명 깨지는 문제 해결 (0) | 2023.04.17 |
macos Safari 개발자 모드 적용 및 단축키 (0) | 2023.04.17 |
Dock % launchpad 초기화 (0) | 2023.04.17 |
macOS JDK 설치 및 설정 (0) | 2022.12.07 |