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

[JAVA] IntelliJ IDEA - Project language level ์„ค์ •์˜ ์˜๋ฏธ

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

Project Structure

IntelliJ IDEA์˜ Project Structure ์ฐฝ์—์„œ Project SDK, Project language level ์„ค์ •์„ ์ฐพ์„ ์ˆ˜ ์žˆ๋‹ค.

 

โ€ป ์ฐธ๊ณ  - Project Structure
์ƒ๋‹จ ๋ฉ”๋‰ด์˜ File - Project Structure ํด๋ฆญ ํ˜น์€ ๋‹จ์ถ•ํ‚ค Ctrl + Alt + Shift + S (์œˆ๋„์šฐ ๊ธฐ์ค€)

 

Project language level์€ ์‹ค์ œ๋กœ ๋ฌด์—‡์„ ์„ค์ •ํ•˜๋Š”๊ฐ€?

Project language level์€ IntelliJ์˜ editor(ํŽธ์ง‘๊ธฐ)์™€ java compiler๊ฐ€ ์‚ฌ์šฉํ•  language level์„ ์„ค์ •ํ•œ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, JDK 1.7์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์ง€๋งŒ java ์ฝ”๋“œ๊ฐ€ JDK 1.6๊ณผ ํ˜ธํ™˜๋˜๋„๋ก ํ•˜๋ ค๋ฉด language level์„ ์‹ค์ œ JDK ์ง€์›(JDK 1.7์˜ ๊ฒฝ์šฐ 7.0)๋ณด๋‹ค ๋‚ฎ์€ 6.0์œผ๋กœ ์„ค์ •ํ•˜๋ฉด ๋œ๋‹ค.

 

1
2
3
4
5
6
7
C:\>javac -help
Usage: javac <options> <source files>
where possible options include:
  -source <release>
        Provide source compatibility with specified release
  -target <release>            
        Generate class files for specific VM version
cs

Java ์ปดํŒŒ์ผ๋Ÿฌ ๋ช…๋ น์ธ javac์˜ ์˜ต์…˜์„ ๋ณด๋ฉด -source ๋ฐ -target ์˜ต์…˜์„ ํ†ตํ•ด Java์˜ ๋Œ€์ฒด ๋ฒ„์ „์„ ๊ธฐ์ค€์œผ๋กœ ์ปดํŒŒ์ผํ•  ์ˆ˜ ์žˆ์Œ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด Project language level์€ IntelliJ์—๊ฒŒ ํŠน์ • Java ์–ธ์–ด ๋ฒ„์ „์—์„œ ์ œ๊ณต๋œ Java SDK๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ์ง€์‹œํ•œ๋‹ค.
๊ทธ๋ž˜์„œ Java 7์ด ์„ค์น˜๋˜์–ด ์žˆ์–ด๋„ language level์„ 6.0์œผ๋กœ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๊ณ , IntelliJ๋Š” Java 7 ๋Œ€์‹  Java 6์„ ๊ธฐ์ค€์œผ๋กœ ์ฝ”๋“œ๋ฅผ ํ™•์ธํ•˜๊ณ , suggestion์„ ์ œ๊ณตํ•˜๋ฉฐ, ์ปดํŒŒ์ผํ•œ๋‹ค.

 

Project Structure - Project language level

Project language level์„ ๋ˆŒ๋Ÿฌ ๋ชฉ๋ก์„ ๋ณด๋ฉด ๋‹ค์–‘ํ•œ ์ข…๋ฅ˜์˜ language level๋กœ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Œ์„ ์•Œ ์ˆ˜ ์žˆ๋‹ค. SDK default๋Š” ์‚ฌ์šฉํ•˜๋Š” JDK์™€ ๋™์ผํ•œ language level์„ ์‚ฌ์šฉํ•˜๋„๋ก ํ•œ๋‹ค.

 

๋ชจ๋“  ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ์˜ Project lanuage level ์„ค์ •ํ•˜๊ธฐ

IntelliJ IDEA ๋ฉ”๋‰ด

File - Other Settings - Structure for New Projects... ์—์„œ ๋ชจ๋“  ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ์˜ language level์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

 

Project Structure for New Projects

๊ทธ๋Ÿฌ๋ฉด Project Structure for New Projects ์ฐฝ์ด ์—ด๋ฆฐ๋‹ค. ์—ฌ๊ธฐ์„œ Project language level์„ ์›ํ•˜๋Š” ์˜ต์…˜์œผ๋กœ ์„ค์ •ํ•˜๋ฉด ๋œ๋‹ค. ์˜ˆ์ „ ๋ฒ„์ „์—์„œ๋Š” ์„ค์ •์„ ํ•ด๋„ language level์ด 6.0์œผ๋กœ ๊ณ ์ •๋˜๋Š” ๋ฒ„๊ทธ๊ฐ€ ์žˆ์—ˆ๋‹ค๊ณ  ํ•˜๋Š”๋ฐ, ๋‚˜๋Š” 2019.3(Community edition)์„ ์‚ฌ์šฉ์ค‘์ด๋ฉฐ ํ•ด๋‹น ๋ฒ„๊ทธ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š”๋‹ค.

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€