๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
IT-Engineering/Java

์ž๋ฐ”(Java) ๋ฒ„์ „ ํ™•์ธ ๋ฐ ๊ธฐ๋ณธ์œผ๋กœ ์‚ฌ์šฉํ•  Java ๋ฒ„์ „ ๋ณ€๊ฒฝํ•˜๊ธฐ(JDK ์—ฌ๋Ÿฌ๊ฐœ ์‚ฌ์šฉ์‹œ)

by ๐Ÿงž‍โ™‚๏ธ 2020. 7. 17.
๋ฐ˜์‘ํ˜•

๋ฆฌ๋ˆ…์Šค(Linux)์—์„œ ์ž๋ฐ”(Java) ๊ฒฝ๋กœ๋ฅผ ๋จผ์ € ํ™•์ธํ•˜๊ณ ์ž ํ•œ๋‹ค๋ฉด, ์•„๋ž˜์˜ ๊ธ€์„ ์ฝ์–ด๋ณด๋Š” ๊ฒƒ์„ ์ถ”์ฒœํ•œ๋‹ค!

 

์šฐ๋ถ„ํˆฌ(Ubuntu)์—์„œ ์ž๋ฐ”(Java) ๊ฒฝ๋กœ(path) ์ฐพ๊ธฐ

๊ฐ€๋” ์šฐ๋ถ„ํˆฌ์—์„œ ์ž‘์—…ํ•˜๋‹ค ๋ณด๋ฉด, ๋‚ด๊ฐ€ ์ž๋ฐ”๋ฅผ ๋”ฐ๋กœ ์••์ถ•ํŒŒ์ผ์„ ๋ฐ›์•„์„œ ์„ค์น˜ํ–ˆ๋Š”์ง€ apt-get ๋ช…๋ น์–ด๋กœ ์„ค์น˜ํ–ˆ๋Š”์ง€๋„ ํ—ท๊ฐˆ๋ฆด ๋•Œ๊ฐ€ ์žˆ๋‹ค. (feat.๊ธฐ์–ต๋ ฅ ๊ฐํ‡ด) ์ด์— ์„ค์น˜๋œ ์ž๋ฐ” ๊ฒฝ๋กœ๋ฅผ ์ฐพ๋Š” ๋‘๊ฐ€์ง€ ๋ฐฉ๋ฒ•

gentlesark.tistory.com

Java ๋ฒ„์ „์„ ํ™•์ธํ•˜๋Š” ๋ช…๋ น์–ด๋Š” ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~18.04-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

์ด๋Ÿฐ ํ˜•ํƒœ๋กœ ์ถœ๋ ฅ์ด ๋‚˜์˜ฌ ๊ฒƒ์ด๋‹ค. ๋”ฐ๋กœ ๋ฆฌ๋ˆ…์Šค(Linux)์šฉ ๋ฐ”์ด๋„ˆ๋ฆฌ(Binary)๋ฅผ ๊ฐ€์ ธ์™€์„œ ์„ค์น˜ํ•œ ๊ฒฝ์šฐ๊ฐ€ ์•„๋‹ˆ๋ผ๋ฉด, ๋‹ค์Œ์˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์„ค์น˜๋œ Java ๋ฒ„์ „๊ณผ ๊ฒฝ๋กœ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

update-alternatives --list java
/usr/lib/jvm/java-11-openjdk-amd64/bin/java
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

์ถœ๋ ฅ๋˜๋Š” ํ˜•ํƒœ๋Š” ์œ„์™€ ๊ฐ™๋‹ค. ์œ„์™€๊ฐ™์ด ๋‘๊ฐ€์ง€ ๋ฒ„์ „์ด ํ™•์ธ๋˜์—ˆ๋‹ค๋ฉด, ๋‘˜์ค‘์— ๋ฌด์—‡์„ ์ตœ์šฐ์„ ์œผ๋กœ ์„ ํƒ๋˜๊ฒŒ ํ•  ๊ฒƒ์ธ์ง€ ์„ ํƒํ•  ์ˆ˜ ์žˆ๋‹ค. ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•ด๋ณด์ž.

update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press <enter> to keep the current choice[*], or type selection number:

์œ„์™€ ๊ฐ™์ด ๋ฉ”๋‰ด๊ฐ€ ๋–ด๊ณ , ์—ฌ๊ธฐ์„œ 11๋ฒ„์ „์ด ์•„๋‹ˆ๋ผ 8๋ฒ„์ „์œผ๋กœ ๋ฐ”๊พธ๊ฒ ๋‹ค ํ•˜๋ฉด 2๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ๋œ๋‹ค.

์ด๋ ‡๊ฒŒ ๊ธฐ๋ณธ ์ž๋ฐ” ์„ค์ •์„ ๋ฐ”๊พธ์—ˆ๋‹ค๋ฉด, ๋งจ ์œ„์˜ ์ž๋ฐ” ๋ฒ„์ „ ํ™•์ธ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ์ž˜ ์ ์šฉ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•ด๋ณด์ž. ๊ทธ๋Ÿผ ๋.

๋ฐ˜์‘ํ˜•

'IT-Engineering > Java' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

์šฐ๋ถ„ํˆฌ(Ubuntu)์—์„œ ์ž๋ฐ”(Java) ๊ฒฝ๋กœ(path) ์ฐพ๊ธฐ  (0) 2020.03.26

๋Œ“๊ธ€