localhost: Error: JAVA_HOME is not set and could not be found.

 localhost: Error: JAVA_HOME is not set and could not be found.
~/.bash_profile에 JAVA_HOME 환경변수가 설정되어 있음에도 hadoop shell 명령어(ex. start-yarn.sh)를 실행할 때 위의 에러 메세지가 발생한다면 ~/.bashrc에 아래와 같이 JAVA_HOME환경변수를 등록하고 hadoop shell 명령어를 실행해 보자. 물론 /usr/local/java 디렉토리는 JDK가 설치된 디렉토리이어야 한다.

[nextman@centos01 ~]$ vi ~/.bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

export JAVA_HOME=/usr/local/java

# User specific aliases and functions
[nextman@centos01 ~]$ source ~/.bashrc

 

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다