Obsidian/Recognition/Programing/Linux/Ubuntu/우분투에 자바 설치.md

46 lines
1004 B
Markdown
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

#Linux
```Shell
$ sudo apt-get update
$ sudo apt-get upgrade
# 설치가능 목록 확인
yum list java*jdk-devel
# JAVA11 설치
$ sudo apt-get install openjdk-11-jdk
$ sudo apt-get install openjdk-8-jdk
yum install -y java-1.8.0-openjdk.x86_64
# 설치 확인
$ java -version
openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04) OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)
# 설치 확인
$ javac -version
javac 11.0.11
## 환경설정
# ~/.bashrc 열기
$ sudo gedit ~/.bashrc
# ~/.bashrc 파일에 설정 추가
# JAVA_HOME settings
export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java)))) export PATH=$PATH:$JAVA_HOME/bin
# 현재 실행중인 shell에 즉시 적용 (새로 실행한 shell에서는 필요없음)
$ source ~/.bashrc
# 설정 확인
$ echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-am64
# 설치된 JAVA 삭제
$ sudo apt-get purge openjdk*
```