[Eclipse] Must declare a named package because this compilation unit is associated to the named module
LeeDaniel
2022. 12. 20. 14:01
[ Problem ] Java프로젝트 생성후 기본패키지에 Class파일 생성하면 다음과 같은 에러가 발생 [ Error Log ] Error occurred during initialization of boot layer java.lang.module.FindException: Error reading module: Caused by: java.lang.module.InvalidModuleDescriptorException: found in top-level directory (unnamed package not allowed in module)
[ Solution ] 해결 방법은 프로젝트에 자동생성된 module-info.java 파일을 삭제해주면 된다 module-info.java 파일을 삭제해준다 Java프로젝트 생성시 만들어지지 않게 하려면 Module영역의 Create module-info.java file이 자동체크되어있는것을 풀어주고 프로젝트를 생성하자 Create module-info.java file 체크박스를 해제한뒤 생성하자