Category (Click)
๊ฐœ๋ฐœ๋ณด๋“œ ๋•์งˆํ•˜๊ธฐ

VSCode๋กœ ๋”ํ™ฉ์ฑ  ๐Ÿ’จย / mac, VSCode, Java ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ธํŒ…

ย ์ฐจ์™„๊ธฐ - @2/19/2024, 11:03:00 PM

์ด?ํด๋ฆฝ์Šค

ํ•˜๋“œ์›จ์–ด ์œ„์— ์ถ”์ƒํ™” ๋ ˆ์ด์–ด..์•„๋‹ˆ ๋Œ€๋†“๊ณ  VM์ด ์กด์žฌํ•œ๋‹ค๋‹ˆ.. ์ž์›์ด ๋„‰๋„‰ํ•œ PC์ด๋‹ˆ ์ดํ•ดํ•ด์•ผ๊ฒ ์ฃ ..
ํ•˜์ง€๋งŒ ์ดํด๋ฆฝ์Šค๋Š” ๋„์ €ํžˆ ๋ชป์ฐธ๊ฒ ์Šต๋‹ˆ๋‹ค. VSCode์— ์ ˆ์—ฌ์ง„ ์ œ ์†๊ฐ€๋ฝ์ด ์‹คํ–‰์„ ๊ฑฐ๋ถ€ํ•˜๋Š”๊ฑธ์š”
์ด๋ฒˆ ํฌ์ŠคํŒ…์—์„œ๋Š” arm Mac์—์„œ VSCode๋ฅผ ์œ„ํ•œ Java ๊ฐœ๋ฐœํ™˜๊ฒฝ์„ ๊พธ๋ ค๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

SDK ์„ค์น˜

์ˆ˜๊ฐ•์ค‘์ธ ๊ณผ๋ชฉ์—์„œ๋Š” ์ตœ์‹  LTS ๋ฒ„์ „์ธ JDK 21์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
Homebrew๋ฅผ ์ด์šฉํ•˜๋ฉด ์‰ฝ๊ฒŒ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
๋งŒ์•ฝ Homebrew๊ฐ€ ์„ค์น˜๋˜์–ด ์žˆ์ง€ ์•Š๋‹ค๋ฉด ํ„ฐ๋ฏธ๋„์—์„œ ์•„๋ž˜ ๋ช…๋ น์„ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Bash
๋ณต์‚ฌ
brew install openjdk sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
Bash
๋ณต์‚ฌ
์œ„ ๋‘ ๋ช…๋ น์„ ์ž…๋ ฅํ•œ ํ›„ VSCode์—์„œ Java Extension์„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

VSCode Java Extension ์„ค์น˜

Extension Pack for Java๋ฅผ ์„ค์น˜ํ•˜๋ฉด Java ๊ฐœ๋ฐœํ™˜๊ฒฝ์— ํ•„์š”ํ•œ Extension๋“ค์„ ์•Œ์•„์„œ ์„ค์น˜ํ•ด์ค๋‹ˆ๋‹ค.

ํ…Œ์ŠคํŠธ

๊ฐ„๋‹จํ•œ class๋ฅผ ๋งŒ๋“ค์–ด ํ…Œ์ŠคํŠธํ•ด๋ณด์•˜์Šต๋‹ˆ๋‹ค.
public class Test { public static void main(String args[]) { System.out.println("์˜ค๋งˆ์ด๊ฐ“ ์ž๋ฐ”๋ผ๋‹ˆ"); } }
Java
๋ณต์‚ฌ
Test.java
๋””๋ฒ„๊น…๊นŒ์ง€ ์ž˜ ๋จน๋„ค์š”!