JDK : 자바 코드의 번역과 실행을 담당
IDE : 개발 생산성을 높히는 프로그램 (Eclipse, IntelliJ, STS, ...)
프로젝트 : 실제 동작하는 코드 묶음 (Springboot, ...)
JDK 설치확인
java -version
JDK 설치 (설치가 안되어 있다면)
$ brew tap AdoptOpenJDK/openjdk $ brew search openjdk 8 $ brew install adoptopenjdk8
IDE 설치 (IntelliJ IDEA)
macOS Community버전 다운로드 (https://www.jetbrains.com/ko-kr/idea/download)
프로젝트 만들기
스프링부트 프로젝트 생성 (https://start.spring.io/)
GENERATE 버튼 클릭 -> 프로젝트 파일 다운로드 -> 압축 풀기 -> IntelliJ로 열기
오류 (Whitelabel Error Page)
= 웹페이지(.html)를 만들지 않으면 발생함.
hello.html 파일 생성 (* 파일경로 = src/main/resources/static)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <h1> Hello World! </h1> </body> </html>
홈페이지 접속
Springboot 실행 -> localhost:8080/hello.html 접속 -> "Hello World!" 출력
꿀팁
1. Port번호 변경 방법
application.properties에 server.port = "port 번호" 입력 후 재 빌드
ex) server.port=8081 -> localhost:8081/hello.html로 접속
2. Port번호가 이미 사용중일 때, (error mac web server failed to start. port "port 번호" was already in use.)
특정 port 확인 : sudo lsof -i:"port 번호"
특정 port 닫기 : sudo kill -9 "PID 값"