Skip to content

[Bug]: Project build / compilation fail when we try to run any class.  #179

Open

Description

Hi,
Whenever we try to run any class locally the IDE gives compilation error for many classes due to not properly following coding standard.
project-level-compilation-errors

I will take ownership and try to fix all issues, so next time whenever a new / existing contributor try to run any file then there wont be any compilation issue.

Regards,

Activity

  1. Krish-Jain30 commented on Apr 6, 2025

    @Krish-Jain30

    Main Problem: Public class names and filenames do not match

    Java requires that a public class must be in a file with the same name as the class.

    Class AreaRect is public, should be declared in a file named AreaRect.java

    You do have areaRect.java, but the file name starts with a lowercase 'a'.
    Java is case-sensitive, so areaRect.java is not same as AreaRect.java.

    To fix:
    Rename all your files so the filename matches the public class name exactly (case-sensitive).
    Remove the public modifier if you want to keep multiple classes in one file (not common for large programs).

    Also fix this issue shown in the log:
    Your file is not inside a directory named area, but your class declares package area
    You either need to remove or fix the package declaration, or put the file inside a folder called area/ inside your Programs folder.

    If you're not using packages explicitly, just remove the package declarations at the top of each file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions