# 현재 사용 중인 버전 확인
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
14.0.1, x86_64: "OpenJDK 14.0.1" /Users/cjos/Library/Java/JavaVirtualMachines/openjdk-14.0.1/Contents/Home
1.8.0_172, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home
# 변경
$ export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
$ source ~/.bash_profile
$ java -version
java version "1.8.0_172" Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
# 안쓰는 버전 삭제
$ cd /Users/cjos/Library/Java/JavaVirtualMachines/
$ sudo rm -rf openjdk-14.0.1