๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Environment·Tool

JAVA ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ๊ตฌ์ถ• - JDK, IntelliJ ์„ค์น˜ ๋ฐ ๊ธฐ๋ณธ ํ™˜๊ฒฝ ์„ค์ •

by Leica 2020. 1. 30.
๋ฐ˜์‘ํ˜•

JAVA ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ๊ตฌ์ถ•ํ•˜๊ธฐ

1. JDK ์„ค์น˜
2. IntelliJ IDEA ์„ค์น˜
3. ๊ธฐ๋ณธ ํ™˜๊ฒฝ ์„ค์ •

 

1. JDK ๋‹ค์šด๋กœ๋“œ ๋ฐ ์„ค์น˜

๋ฌด๋ฃŒ๋กœ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ OpenJDK์ธ Amazon Correto๋ฅผ ๋‹ค์šด๋กœ๋“œ๋ฐ›์•„ ์„ค์น˜ํ•œ๋‹ค. ์ด ์™ธ์— ๋‹ค๋ฅธ Vendor์˜ ๋ฐฐํฌํŒ์„ ์‚ฌ์šฉํ•ด๋„ ๋ฌด๋ฐฉํ•˜๋‹ค.

 

Amazon Corretto๋Š” ๋ฌด๋ฃŒ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” Open Java Development Kit(OpenJDK)์˜ ํ”„๋กœ๋•์…˜์šฉ ๋ฉ€ํ‹ฐํ”Œ๋žซํผ ๋ฐฐํฌํŒ์ž…๋‹ˆ๋‹ค. Corretto์—๋Š” ์„ฑ๋Šฅ ๊ฐœ์„  ๋ฐ ๋ณด์•ˆ ์ˆ˜์ • ์‚ฌํ•ญ์„ ๋น„๋กฏํ•œ ์žฅ๊ธฐ ์ง€์›์ด ํ•จ๊ป˜ ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค. Amazon์€ ๋‚ด๋ถ€์ ์œผ๋กœ ์ˆ˜์ฒœ ๊ฐœ์˜ ํ”„๋กœ๋•์…˜ ์„œ๋น„์Šค์—์„œ Corretto๋ฅผ ์‹คํ–‰ํ•˜๋ฉฐ, Corretto๋Š” Java SE ํ‘œ์ค€๊ณผ ํ˜ธํ™˜๋˜๋Š” ๊ฒƒ์œผ๋กœ ์ธ์ฆ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. Corretto๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด Linux, Windows ๋ฐ macOS๋ฅผ ๋น„๋กฏํ•œ ์ธ๊ธฐ ์žˆ๋Š” ์šด์˜ ์ฒด์ œ์—์„œ Java ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ฐœ๋ฐœํ•˜๊ณ  ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

- ์ถœ์ฒ˜ : Amazon

 

https://aws.amazon.com/ko/corretto/

 

Amazon Corretto ํ”„๋กœ๋•์…˜์šฉ OpenJDK ๋ฐฐํฌ

Amazon Corretto๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํด๋ผ์šฐ๋“œ, ์˜จํ”„๋ ˆ๋ฏธ์Šค ๋ฐ ๋กœ์ปฌ ์‹œ์Šคํ…œ์—์„œ ๋™์ผํ•œ ํ™˜๊ฒฝ์„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Corretto 8๋Š” Linux, Windows, macOS, ๋ฐ Docker๋ฅผ ์ง€์›ํ•˜๋ฉฐ, Corretto 11๋Š” Linux, Windows ๋ฐ macOS๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

aws.amazon.com

์œ„ URL๋กœ ์ ‘์†ํ•ด์„œ Amazon Corretto 11 ๋‹ค์šด๋กœ๋“œ ํ•˜๊ธฐ๋ฅผ ํด๋ฆญํ•œ๋‹ค.

 

๋‹ค์šด๋กœ๋“œ ํŽ˜์ด์ง€

๋‹ค์šด๋กœ๋“œ ํŽ˜์ด์ง€์—์„œ ์ž์‹ ์˜ OS์— ๋งž๋Š” ์„ค์น˜ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œ ๋ฐ›๋Š”๋‹ค. ์œˆ๋„์šฐ๋ผ๋ฉด ์œ„ ๊ทธ๋ฆผ์˜ msi ํŒŒ์ผ์„ ๋ฐ›์œผ๋ฉด ๋œ๋‹ค. msi๋Š” executable installer file์„ ์˜๋ฏธํ•œ๋‹ค. zip ํŒŒ์ผ์„ ๋ฐ›์•„์„œ ์••์ถ•์„ ํ’€์–ด๋„ ๋˜์ง€๋งŒ ์„ค์น˜ ํŒŒ์ผ์„ ์‚ฌ์šฉํ•˜๋Š”๊ฒŒ ํŽธํ•˜๋‹ค.

 

์„ค์น˜ ๊ณผ์ •์—์„œ ์ž๋™์œผ๋กœ ํ™˜๊ฒฝ๋ณ€์ˆ˜์— JDK ๊ฒฝ๋กœ๊ฐ€ ์„ค์ •๋˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. ์„ค์น˜ ๊ณผ์ • ์ค‘ ๋”ฐ๋กœ ์„ค์ •ํ•  ๊ฑด ์—†๊ณ  Next๋ฅผ ๋ˆŒ๋Ÿฌ ์„ค์น˜๋ฅผ ๋งˆ์นœ๋‹ค.

 

์„ค์น˜๊ฐ€ ๋๋‚˜๋ฉด Command ์ฐฝ์„ ๋„์›Œ (์‹คํ–‰ -> cmd ์ž…๋ ฅ) java -version ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•ด ์„ค์น˜ ๋ฐ ํ™˜๊ฒฝ๋ณ€์ˆ˜ ์„ค์ •์ด ์ œ๋Œ€๋กœ ์™„๋ฃŒ๋๋Š”์ง€ ํ™•์ธํ•œ๋‹ค.

 

[์ฐธ๊ณ ] JDK ํ™˜๊ฒฝ๋ณ€์ˆ˜ ์„ค์ •

1. JAVA_HOME ์„ค์ •

์œ„์™€ ๊ฐ™์ด msi ํŒŒ์ผ์„ ํ†ตํ•ด ์„ค์น˜ํ•œ ๊ฒฝ์šฐ ์ด ํ™˜๊ฒฝ๋ณ€์ˆ˜ ์„ค์ • ๊ณผ์ •์ด ํ•„์š” ์—†๋‹ค. ์ด ๋‚ด์šฉ์€ zip ํŒŒ์ผ๋กœ ์„ค์น˜ํ–ˆ๊ฑฐ๋‚˜ ์—ฌ๋Ÿฌ ๋ฒ„์ „์˜ JDK๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋“ฑ์˜ ์ด์œ ๋กœ ํ™˜๊ฒฝ๋ณ€์ˆ˜๋ฅผ ์ˆ˜๋™์œผ๋กœ ์„ค์ •ํ•˜๊ณ ์ž ํ•  ๋•Œ ์ฐธ๊ณ ํ•œ๋‹ค.

 

์œˆ๋„์šฐ ํƒ์ƒ‰๊ธฐ์—์„œ ๋‚ด PC - ์†์„ฑ ํด๋ฆญ

 

์‹œ์Šคํ…œ ์†์„ฑ ์ฐฝ์—์„œ [๊ณ ๊ธ‰] ํƒญ - [ํ™˜๊ฒฝ ๋ณ€์ˆ˜] ํด๋ฆญ

 

์‹œ์Šคํ…œ ๋ณ€์ˆ˜ ์˜์—ญ์— ๊ธฐ์กด์˜ 'JAVA_HOME'์„ ๋ฐ”๊พธ๋ ค๋ฉด ์„ ํƒ ํ›„ [ํŽธ์ง‘]์„, ์ƒˆ๋กœ ์ถ”๊ฐ€ํ•˜๋ ค๋ฉด [์ƒˆ๋กœ ๋งŒ๋“ค๊ธฐ] ํด๋ฆญ

 

๋ณ€์ˆ˜ ์ด๋ฆ„์— JAVA_HOME์„, ๋ณ€์ˆ˜ ๊ฐ’์— JDK ์„ค์น˜ ๊ฒฝ๋กœ๋ฅผ ์ž…๋ ฅํ•˜๊ณ  [ํ™•์ธ] ํด๋ฆญ

 

 

2. Path ์ถ”๊ฐ€

์‹œ์Šคํ…œ ๋ณ€์ˆ˜ ์˜์—ญ์˜ 'Path' ์„ ํƒ ํ›„ [ํŽธ์ง‘] ํด๋ฆญ

 

[์ƒˆ๋กœ ๋งŒ๋“ค๊ธฐ]๋ฅผ ํด๋ฆญํ•˜๊ณ  '%JAVA_HOME%\bin' ์ž…๋ ฅํ•˜๊ณ  [ํ™•์ธ]์„ ํด๋ฆญํ•˜์—ฌ ๋ณ€์ˆ˜ ์„ค์ •์„ ๋งˆ์นœ๋‹ค.

 

2. IntelliJ IDEA ๋‹ค์šด๋กœ๋“œ ๋ฐ ์„ค์น˜

https://www.jetbrains.com/

 

JetBrains: Developer Tools for Professionals and Teams

JetBrains is a cutting-edge software vendor specializing in the creation of intelligent development tools, including IntelliJ IDEA – the leading Java IDE, and the Kotlin programming language.

www.jetbrains.com

 

์œ„ URL์— ์ ‘์†ํ•ด์„œ Tools - IntelliJ IDEA๋ฅผ ํด๋ฆญํ•œ๋‹ค.

 

[DOWNLOAD] ํด๋ฆญ

 

OS(Windows)๋ฅผ ์„ ํƒํ•˜๊ณ  ๋‘ ๊ฐ€์ง€ ์˜ต์…˜ Ultimate, Community ์ค‘ ๋ฌด๋ฃŒ ๋ฒ„์ „์ธ Community๋ฅผ ๋‹ค์šด๋กœ๋“œํ•œ๋‹ค.

 


์ฐธ๊ณ ๋กœ java ์›น ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ฐœ๋ฐœ์„ ์œ„ํ•ด์„œ๋Š” IntelliJ IDEA ์œ ๋ฃŒ ๋ฒ„์ „์ด ํ•„์š”ํ•œ๋ฐ, ๋Œ€ํ•™๊ต ์ด๋ฉ”์ผ ์ธ์ฆ์„ ํ†ตํ•ด ์žฌํ•™์ƒ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ์กธ์—…์ƒ๋„ ๊ต์œก ๋ผ์ด์„ผ์Šค๋ฅผ ๋ฐ›์•„ ๋ฌด๋ฃŒ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. ์ด ๋ฐฉ๋ฒ•์— ๊ด€ํ•ด์„œ๋Š” ์•„๋ž˜ ๋งํฌ๋ฅผ ์ฐธ๊ณ ํ•˜์ž.

 

https://atoz-develop.tistory.com/entry/IntelliJ-IDEA-๋ฌด๋ฃŒ๋กœ-์‚ฌ์šฉํ• -์ˆ˜-์žˆ๋Š”-๊ต์œก-๋ผ์ด์„ผ์Šค-๋ฐ›๋Š”-๋ฐฉ๋ฒ•

 

IntelliJ IDEA - ๋ฌด๋ฃŒ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ต์œก ๋ผ์ด์„ผ์Šค ๋ฐ›๋Š” ๋ฐฉ๋ฒ•

IntelliJ IDEA๋Š” Ultimate(์œ ๋ฃŒ ๋ฒ„์ „)๊ณผ Community(๋ฌด๋ฃŒ ๋ฒ„์ „)์˜ ์ง€์› ๊ธฐ๋Šฅ ์ฐจ์ด๊ฐ€ ๋งค์šฐ ํฌ๋‹ค. ํŠนํžˆ ์ž๋ฐ” ์›น ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๊ฐœ๋ฐœํ•˜๋ ค๋ฉด Ultimate ๋ผ์ด์„ผ์Šค๊ฐ€ ํ•„์ˆ˜์ ์ธ๋ฐ ๋Œ€ํ•™๊ต์˜ ์ด๋ฉ”์ผ ์ธ์ฆ์„ ํ†ตํ•ด ๊ต์œก ๋ผ์ด์„ผ..

atoz-develop.tistory.com


 

Installation Options์—์„œ๋Š” ํ‘œ์‹œ๋œ ๊ฒƒ์„ ์ฒดํฌํ•˜๋ฉด ๋˜๋Š”๋ฐ, Create Desktop Shortcut์€ ๋ณธ์ธ ์šด์˜์ฒด์ œ์— ๋งž๋Š” ์˜ต์…˜(32bit/64bit)์„ ์„ ํƒํ•œ๋‹ค.

 

์„ค์น˜๊ฐ€ ์ข…๋ฃŒ๋˜๋ฉด ๊ธฐ๋ณธ ์„ค์ •์„ ์œ„ํ•ด IntelliJ IDEA๋ฅผ ์‹คํ–‰ํ•œ๋‹ค.

 

 

3. ๊ธฐ๋ณธ ํ™˜๊ฒฝ ์„ค์ •

1. IntelliJ IDEA ์ดˆ๊ธฐ ์„ค์ •

์ฒ˜์Œ ์‹คํ–‰ํ•˜๋ฉด IntelliJ ์„ค์ •์„ Import ํ• ๊ฒƒ์ธ์ง€ ๋ฌผ์–ด๋ณด๋Š”๋ฐ, ํ•ด๋‹นํ•˜์ง€ ์•Š์œผ๋ฉด Do not import settings๋ฅผ ์„ ํƒํ•œ๋‹ค.

 

UI ํ…Œ๋งˆ๋ฅผ ์„ ํƒํ•œ๋‹ค. ์ถ”ํ›„ ๋ณ€๊ฒฝ ๊ฐ€๋Šฅํ•˜๋‹ค.

 

๊ทธ๋Œ€๋กœ [Next: Feature plugins]๋ฅผ ํด๋ฆญํ•œ๋‹ค.

 

๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ๋ณ€๊ฒฝ ์—†์ด [Start using IntelliJ IDEA]๋ฅผ ํด๋ฆญํ•œ๋‹ค.

 

2. JDK ์„ค์ •

Configure - Structure for New Projects๋ฅผ ํด๋ฆญํ•œ๋‹ค.

 

์ขŒ์ธก ๋ฉ”๋‰ด์—์„œ Project ์„ ํƒ, Project SDK์— ์„ค์น˜ํ•œ JDK๋ฅผ ์„ ํƒํ•œ๋‹ค.

๋งŒ์ผ ํ•ด๋‹น ์˜ต์…˜์ด ์ž๋™์œผ๋กœ ์ƒ๊ธฐ์ง€ ์•Š์•˜์„ ๊ฒฝ์šฐ,

 

[New] - JDK ํด๋ฆญ

 

JDK ๊ฒฝ๋กœ๋ฅผ ์ง์ ‘ ์„ ํƒ/์ž…๋ ฅํ•˜์—ฌ [OK]๋ฅผ ํด๋ฆญํ•œ๋‹ค.

 

์ฐธ๊ณ ๋กœ ์—ฌ๋Ÿฌ ๊ฐœ์˜ JDK๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ์—” SDKs ๋ฉ”๋‰ด์—์„œ [+] ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์—ฌ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋‹ค.

 

 

3. VM Option - Encoding ์„ค์ •

์œ„ ์‚ฌ์ง„์ฒ˜๋Ÿผ output ์ฐฝ์—์„œ ํ•œ๊ธ€์ด ๊นจ์ง€๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด IntelliJ vm ์˜ต์…˜์— ์ถ”๊ฐ€ํ•ด์ค„ ๊ฒƒ์ด ๋‚จ์•˜๋‹ค.

 

์•ก์…˜ ๊ฒ€์ƒ‰์„ ์ผœ๊ณ (Ctrl + Shift + A) vm์„ ์ž…๋ ฅํ•˜๊ณ  ๊ฒฐ๊ณผ์—์„œ Edit Custom VM Options...๋ฅผ ํด๋ฆญํ•œ๋‹ค.

 

๊ทธ๋Ÿฌ๋ฉด ์•„๋ž˜์™€ ๊ฐ™์ด VM option์„ ์„ค์ •ํ•˜๋Š” ํ…์ŠคํŠธ ํŒŒ์ผ์ด ์—ด๋ฆฌ๋Š”๋ฐ,

 

๋งˆ์ง€๋ง‰ ํ–‰์— -Dfile.encoding=UTF-8์„ ์ถ”๊ฐ€ํ•œ ๋’ค ์ถ”๊ฐ€ํ•œ ์˜ต์…˜์„ ์ ์šฉํ•˜๊ธฐ ์œ„ํ•ด IntelliJ๋ฅผ ์žฌ๊ธฐ๋™ํ•œ๋‹ค.

 

๊ทธ๋Ÿฌ๋ฉด ํ–ฅํ›„ ๋งˆ์ฃผํ•˜๊ฒŒ๋  ์„œ๋ฒ„ output์ฐฝ์—์„œ ํ•œ๊ธ€์ด ๊นจ์ง€์ง€์•Š๊ณ  ์˜ˆ์˜๊ฒŒ ์ถœ๋ ฅ๋œ๋‹ค.

 

4. ๊ธฐํƒ€ ์„ค์ •

๋‹ค์Œ ์„ค์ •์€ ํ•„์ˆ˜์ ์ธ ๊ฑด ์•„๋‹ˆ๋ฉฐ ๊ฐœ์ธ์˜ ์„ฑํ–ฅ์— ๋”ฐ๋ผ ๋‹ฌ๋ฆฌํ•  ์ˆ˜ ์žˆ๋‹ค.

 

Configure - Settings ํด๋ฆญ

 

Editor - General - Auto Import ๋ฉ”๋‰ด ์„ ํƒ ํ›„ Add unambiguous imports on the fly, Optimize imports on the fly์— ์ฒดํฌํ•˜์—ฌ ์ž๋™ import ๊ธฐ๋Šฅ์„ ์ผ ๋‹ค.

 

Editor - General - Appearance ๋ฉ”๋‰ด ์„ ํƒ ํ›„ Show line numbers ์˜ต์…˜์— ์ฒดํฌํ•œ๋‹ค.

 

Editor - General - Code Folding ๋ฉ”๋‰ด ์„ ํƒ ํ›„ Imports, One-line methods, Closures, Generic constructor and method parameters์— ์ฒดํฌ๋ฅผ ํ•ด์ œํ•œ๋‹ค.

 

์ด๋ ‡๊ฒŒ JDK ์„ค์น˜, IDE ์„ค์น˜, IDE์™€ JDK ์—ฐ๋™ ๋ฐ ๊ธฐ๋ณธ ์„ค์ •์„ ํ•˜๋ฉด ๊ธฐ๋ณธ์ ์ธ java ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ๊ตฌ์ถ•์ด ์™„๋ฃŒ๋œ๋‹ค.

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€