Search code examples
javaeclipseide

Eclipse: Project 'PROJECT_NAME' has no explicit encoding set


I downgraded from Windows 11 to Windows 10 today and had to reinstall the Eclipse-IDE.
After successfully importing my workspaces and fixing the projects, a warning appeared for every project saying "Project XXX has no explicit encoding set". I've already searched for a solution and only got some fixes for VSCode.

I had Eclipse 2021-6 and installed Eclipse 2022-6


Solution

  • Yes, the warning for projects with no explicit default encoding is a new thing in Eclipse 2022-06 (4.24).

    To set an explicit default encoding do one of the following:

    • In the Problems view, select the warning, hit Ctrl+1 and apply the provided Quick Fix (sets the project encoding explicitly to the workspace encoding)
    • Change the project manually in Project > Properties: Resource

    See also my video showing and explaining this.

    When using a build system like Maven or Gradle, set the encoding as follows instead:

    Maven

    1. In pom.xml set the property project.build.sourceEncoding to UTF-8:
      <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>
    2. Right-click the project folder and choose Maven > Update Project...

    Gradle

    1. In build.gradle set compileJava.options.encoding to UTF-8:
      compileJava.options.encoding = 'UTF-8'
    2. Right-click the project folder and choose Gradle > Refresh Gradel Project
    3. As long as Eclipse Buildship issue #344 is not fixed, change the encoding manually as described above