DEV Community

Chrise Nwachukwu
Chrise Nwachukwu

Posted on

Fixing "DemoApplication.java is a Non-Project File"

If you’re seeing the error "DemoApplication.java is a non-project file, only syntax errors are reported", it means your IDE isn’t recognizing your file as part of the project. You could try any of these:

  1. Mark Directory as Source Root: Right-click the folder containing the file, then select Mark Directory as Sources Root.

  2. Reimport the Project: Right-click pom.xml (Maven) or build.gradle (Gradle) and select Reimport.

  3. Check Project SDK: Ensure the correct JDK is configured in Project Structure.

  4. Ensure File Belongs to a Module: Make sure the file is included in a valid module within your project.

These steps should help your IDE recognize the file as part of your project. Let me know if it works!

Top comments (0)