os/MAC

Mac OSX Java 설치

C/H 2015. 11. 27. 08:30

Java 설치

brew update && brew cask install java

Jenv 설치

자바 버전관리툴 설치

brew install https://raw.githubusercontent.com/entrypass/jenv/homebrew/homebrew/jenv.rb
echo 'eval "$(jenv init -)"' >> ~/.bash_profile

Jenv 에 자바 등록

# jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home /Users/<username>/Github/homebrew/Library/Formula oracle64-1.8.0.05 added
#jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home /Users/<username>/git/homebrew/Library/Formula oracle64-1.8.0.66 added
jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home /Users/<username>/git/homebrew/Library/Formula oracle64-1.8.0.72 added

#에러 ln: /Users/uncaose/.jenv/versions/oracle64-1.8.0.66: No such file or directory
# 폴더 생성 후 다시 추가 
mkdir .jenv/versions

# 설치 버전 확인 
jenv versions
* system (set by /Users/uncaose/.java-version)
  oracle64-1.8.0.66


# 디폴트(Global) 자바 설정
jenv global oracle64-1.8.0.66
jenv versions
  system
* oracle64-1.8.0.66 (set by /Users/uncaose/.jenv/version)

# 로컬(현재 세션) 자바 설정
jenv local system
jenv versions
* system (set by /Users/uncaose/.java-version)
  oracle64-1.8.0.66

# JAVA_HOME 설정
jenv exec bash

jenv exec bash
echo $JAVA_HOME
/Users/username/.jenv/versions/oracle64-1.8.0.66


반응형

'os > MAC' 카테고리의 다른 글

homebrew 삭제  (0) 2016.11.07
Mac DNS 캐시 재설정  (0) 2016.08.23
Mac OSX 에서 htop  (0) 2015.10.30
Mac OSX 에서 Bash  (0) 2015.10.29
MAC 화면캡처  (0) 2015.10.13