📌IDE (Intergrated Development Evironment)
- 통합 개발 환경으로 프로그램 개발에 관련된 모든 작업을 할 수 있는 도구
- 애플리케이션을 구축하기위한 소프트웨어
- Eclipse, IntelliJ ...
📌Java시 개발환경구축
- Workspace 클론한 폴더 지정 후 실행 → Open Perspective → Java로 변경
- 왼 Package, Navigator / 아래 Problems, Console
- Window → Preferences → General → Workspace → encoding(UTF-8)
- Window → Preferences → General → Editors → Text Editors → Spelling
→ Encoding(UTF-8)
- Window → Preferences → Java → Code Style → Code Templates
→ Code → Method body, Catch block body 주석 삭제
- .gitignore(형상관리에서 제외)를 commit & push
// 주석
/*
* 여러줄 주석
*/
- Import
- Import → General → Existing Projects into Workspace → Next
→ (압축형태일경우) Select archive file → 압축파일 선택 → Finish
📌Server시 개발환경구축
- 아파치 톰캣 9버전 (자바 11버전과 호환이 잘 됨) Core.zip 다운로드
압축을 풀면 서버를 구축한 것임
- Open Perspective → Java EE
- 왼 Project Explorer, Navigator / 아래 Servers, Problems, Console
- Window → Preferences → General → Workspace → encoding(UTF-8)
- Window → Preferences → General → Editors → Text Editors → Spelling
→ Encoding(UTF-8)
- Window → Preferences → Web → CSS Files, HTML Files, JSP Files → Encoding(UTF-8)
- Window → Preferences → XML → XML Files → Encoding(UTF-8)
- Window → Preferences → Java → Code Style → Code Templates
→ Code → Method body, Catch block body 주석 삭제
- Window → Preferences → Server → Runtime Environments → Add
→ Apache Tomcat v9.0 → Name 변경 가능, Browse로 apache tomcat 폴더 선택
- (Servers 탭에 서버를 생성해야 서버 실행 가능) New Server
→ Server type 선택, Server's host name 변경 불가, Server name 변경 가능
, Server runtime environment에 add해놓은 목록이 뜸
→ 서버 위에 구동시킬 Web application 선택
- 생성한 서버 더블클릭 → Ports
→ Tomcat admin port와 HTTP/1.1의 Port Number은 중복 불가
(이미 오라클에서 8080을 사용중)
- 생성한 서버 더블클릭 → Server Options → Serve modules without publishing 체크
- New Dynamic Web Project → Project name 작성
→ output folder : src/main/webapp/WEB-INF/classes
(컴파일된 .class 파일들을 보관할 폴더이며
추 후 서버 배포시 webapp폴더만 배포되므로 경로지정시 webapp폴더 내부로 지정)
→ Context root(이 web application만의 고유 별칭) 고유한 이름으로 재정의 권장
, Content directory(실제 배포되는 폴더의 경로)
, Generate web.xml deployment descriptor(배포 서술자, DD) 체크
- Project Explorer → 프로젝트에 마우스 오른쪽 버튼 → Properties → Project Facets
→ Dynamic Web Module, Java, JavaScript 체크, Java 버전 확인
, Runtimes에서 Apache Tomcat v9.0 체크
- Project Explorer → 프로젝트에 마우스 오른쪽 버튼 → Properties → Java Build Path
→ JRE System Library 자바 버전 확인
(만약 버전 수정시 Libraries에서 JRE System Library선택 후 Edit로 default값 설정)
- Project Explorer → 프로젝트에 마우스 오른쪽 버튼 → Properties → Java Compiler
→ Compiler compliance level : 11 확인
- 생성한 서버에 마우스 오른쪽 버튼 → Add and Remove
→ 서버에 웹 어플리케이션(다이나믹 프로젝트)을 Add하여 구동
(Add 여러개 가능하며 Context root명으로 구분)