-
Ubuntu(우분투) 환경에서 Java 초간편 설치하기스터디 노트 2023. 12. 13. 16:56
우분투 설치 환경에서 Java 17 버전을 설치해보려 합니다.
우선 먼저 apt-get을 통해 설치할 것이기에 apt-get을 update와 upgrade 해줍니다.
> sudo apt-get update > sudo apt-get upgrade
업데이트가 다 되었으면 Java 17 버전으로 다운로드 합니다.
> sudo apt-get install openjdk-17-jdk 현 시점의 최신 버전인 openjdk version "17.0.9" 2023-10-17 버전이 설치됩니다.
설치가 완료되었습니다.
버전을 확인해보겠습니다.
> java -version openjdk version "17.0.9" 2023-10-17 OpenJDK Runtime Environment (build 17.0.9+9-Ubuntu-122.04) OpenJDK 64-Bit Server VM (build 17.0.9+9-Ubuntu-122.04, mixed mode, sharing)
설치를 확인하였으니 이제 환경변수를 통해 JAVA_HOME을 설정해줄겁니다.
~/.bashrc 파일 내에 JAVA_HOME을 잡아주도록 하죠.
> vi ~/.bashrc # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples ...(생략)... export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java)))) export PATH=$PATH:$JAVA_HOME/bin
아래 export 부분을 추가해줍니다. 그리고 bashrc 파일을 재적용시켜줍니다.
> source ~/.bashrc > echo $JAVA_HOME /usr/lib/jvm/java-17-openjdk-amd64
환경설정 정보까지 확인이 완료되었습니다.
수고하셨습니다!
'스터디 노트' 카테고리의 다른 글
레디스(Redis)? 함 써봅시다. Spring Boot + Redis 연동하기! (1) 2023.12.21 레디스란? 레디스의 백업 프로세스에 대하여 (0) 2023.12.20 Ubuntu 환경에서 Logstash와 Opensearch 연동하기 : logstash-input-opensearch Plugin input/output 설정 (0) 2023.12.13 윈도우 10에서 Docker(도커)에 Ubuntu(우분투) 최신 버전 설치하기 (0) 2023.12.13 Apache HttpClient 5 알아보기 (0) 2023.12.06