JAVA/공부
IntelliJ 한글 깨짐 (IntelliJ/Gradle/터미널/콘솔/file/컴파일/빌드/VM)
호 두
2022. 8. 4. 09:47
반응형
1. IntelliJ 프로젝트 한글 깨짐
해결방법 :
- File > Project Settings > Project 항목 SDK / language level 변경 (language level이 너무 높은경우 oracle/intelliJ 한글지원 x)
2. 프로젝트 VM 한글 깨짐
해결방법 :
- Help > VM option > encoding 설정 2개 추가
-Dfile.encoding=UTF-8
-Dconsole.encoding=UTF-8
3. 콘솔/터미널 한글 깨짐
해결방법 :
- File > Settings > Gradle > using 항목 2개를 모두 IntelliJ IDEA로 변경
4. 콘솔/터미널 명령어를 통한 실행(컴파일) 한글깨짐
ex) ./gradlew test 명령어를 통해 gradle report 파일 (index.html) 생성
=> 경로 : C:\Users\user\Desktop\workspace\프로젝트명\build\reports\tests\test\index.html
=> 파일을 열어보면 한글(@DisplayName)이 깨져있음
=> 아래 설정을 통해 컴파일시 한글깨짐 해결가능
해결방법 :
- bulild.gradle 파일에 아래 코드 추가하기
- 이후 gradle 다시 generate
- 이후 다시 gredle 명령어 실행
tasks.withType(JavaCompile){
options.encoding = "UTF-8"
}
5. 위 설정을 전부 했는데도 한글깨짐
해결방법 :
- File > IDE Caches 초기화
반응형