Written by
Poogle
on
on
JDK 정리
Homebrew-cask-versions
참고:
- 버전 별로 설치 도와주는
Homebrew-cask-versions
brew tap homebrew/cask-versions
# 설치된 파일들 확인
brew list --cask
JDK 종류
OracleJDK
brew install --cask oracle-java
Temurin
brew install --cask temurin
Amazon Corretto
brew install --cask corretto
설치된 jdk 확인
ls /Library/Java/JavaVirtualMachines
주의
/Users/[username]/Library/Java/JavaVirtualMachines
/Library/Java/JavaVirtualMachines
- 설치 위치 구분하기!
JDK 환경변수 설정
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk/Contents/Home
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
$JAVA_HOME
과 java_home
관련 명령어들
JDK 버전 확인
# 설치된 JDK들 전체 확인
/usr/libexec/java_home -V
# 특정 JDK 버전 확인(as if JAVA_VERSION had been set in the environment)
/usr/libexec/java_home -v 1.x
# default JDK 버전 확인
/usr/libexec/java_home
java_home
으로 $JAVA_HOME
쉽게 설정하기
# 특정 버전으로
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
# default로
export JAVA_HOME=`/usr/libexec/java_home`
Uninstall JDK
- JDK 별로 삭제할 것들이 다를 수도 있음
# remove jdk installed directory
sudo rm -rf /Library/Java/JavaVirtualMachines/[설치된 버전]
# remove java control panel
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane
# remove applet plugins
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/
# remove application support
sudo rm -rf ~/Library/Application\ Support/Java
# remove the java updater list
sudo rm -rf /Library/LaunchAgents/com.oracle.java.Java-Updater.plist
sudo rm -rf /Library/PrivilegedHelperTools/com.oracle.java.JavaUpdateHelper
# remove the java helper tool
sudo rm -rf /Library/LaunchDaemons/com.oracle.java.Helper-Tool.plist
sudo rm -rf /Library/Preferences/com.oracle.java.Helper-Tool.plist
참고: How To Install / Uninstall Multiple Java Versions In Mac OS By Home Brew Or Manually