๐ŸŒท๐ŸŒผ๋ชจ์—ฌ๋ด์š” ๊ฐœ๋ฐœ์˜์ˆฒ๐ŸŒท๐ŸŒผ

[Linux] ERROR: JAVA_HOME is set to an invalid directory ํ•ด๊ฒฐ๋ฒ• ๋ณธ๋ฌธ

๊ฐœ๋ฐœ/๊ฐœ๋ฐœ๊ด€๋ จ ๊ธฐํƒ€ ๊ธ€

[Linux] ERROR: JAVA_HOME is set to an invalid directory ํ•ด๊ฒฐ๋ฒ•

์š”์ผ์ด 2023. 2. 15. 09:17
๋ฐ˜์‘ํ˜•

gradle์„ ์„ค์น˜ํ•˜๊ณ  ์„ค์น˜ ํ™•์ธ์„ ์œ„ํ•ด gradle -v ๋ช…๋ น์–ด๋ฅผ ์ณค๋Š”๋ฐ

 

ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.362.b08-1.el7_9.x86_64/jre/bin/java

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

 

์ด๋Ÿฐ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜๋Š”๊ฒƒ์ด๋‹ค.

 

ํ•ด๊ฒฐ๋ฐฉ๋ฒ•์€

readlink -f $(which java)

ํ•˜์—ฌ java๊ฐ€ ์„ค์น˜๋œ ๊ฒฝ๋กœ๋ฅผ ์•Œ์•„๋‚ธ ๋‹ค์Œ ๋งˆ์ง€๋ง‰ /bin ~ ๋ถ€ํ„ฐ ์‚ญ์ œํ•˜์—ฌ

 

์˜ˆ๋ฅผ๋“ค๋ฉด 

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.362.b08-1.el7_9.x86_64/jre/bin/java (๊ฒฝ๋กœ)

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.362.b08-1.el7_9.x86_64/jre (์‚ญ์ œํ•œ ๊ฒฝ๋กœ)

 

vi /etc/profile

์—์„œ JAVA_HOME ๊ฒฝ๋กœ๋ฅผ ๋ฐ”๊พธ๋ฉด ๋œ๋‹ค

Comments