티스토리 뷰

반응형

 

사전 준비 

- iterms2

- homebrew

- zsh(oh-my-zsh)

 

1.  jenv 설치

brew install jenv

 

2.  환경 변수 설정

echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc

echo 'eval "$(jenv init -)"' >> ~/.zshrc

source ~/.zshrc

 

3.  jenv export plugin 설정

jenv enable-plugin export

 

4.  jenv 설치 확인 

jenv

 

아래와 같이 나오면 정상 설치가 된 것이다.

jenv
jenv 0.5.7

Usage: jenv <command> [<args>]

Some useful jenv commands are:
    commands     List all available jenv commands
    local        Set or show the local application-specific Java version
    global       Set or show the global Java version
    shell        Set or show the shell-specific Java version
    rehash       Rehash jenv shims (run this after installing executables)
    version      Show the current Java version and its origin
    versions     List all Java versions available to jenv
    which        Display the full path to an executable
    whence       List all Java versions that contain the given executable
    add          Add JDK into jenv. A alias name will be generated by parsing "java -version"
    remove       Remove JDK installations

See `jenv help <command>' for information on a specific command.
For full documentation, see: 

https://github.com/jenv/jenv/blob/master/README.md

 

5.  JDK 설치

brew install temurin@21

 

6.  jenv에 JDK 등록하기

/usr/libexec/java_home -V

 

위의 명령어를 쳤을 때 내 로컬에서의 예시

Matching Java Virtual Machines (3):
    21.0.5 (arm64) "Eclipse Adoptium" - "OpenJDK 21.0.5" /Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home
    17.0.11 (arm64) "Homebrew" - "OpenJDK 17.0.11" /opt/homebrew/Cellar/openjdk@17/17.0.11/libexec/openjdk.jdk/Contents/Home
    14.0.2 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 14" /Library/Java/JavaVirtualMachines/adoptopenjdk-14.jdk/Contents/Home

 

위의 예시와 같이 원하는 버전의 경로를 추가한다. (/Library/Java 로 시작해서 /Home 으로 끝나는 path)

jenv add /Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home

 

7.  jenv에 JDK 설정하기

# 설치된 버전 확인
jenv versions 

# 글로벌 버전 설정
jenv global 21

# 로컬 버전 설정
jenv local 17

 

 

https://velog.io/@dongs52/jenv-%EB%A5%BC-%EC%82%AC%EC%9A%A9%ED%95%9C-%EC%97%AC%EB%9F%AC-java-%EB%B2%84%EC%A0%84-%EA%B4%80%EB%A6%AC

https://v3.leedo.me/devs/90

반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함
반응형