Class "Robot" needs to be defined in it's own file

I’ve run into this Java compile error more than once and it doesn’t make sense. In the source file Robot.java, I declare the class “Robot”

public class Robot extends TimedRobot {


}

I get the compile error:

Task :compileJava FAILED
C:\Users\3Zman\VS Workspace\IntakeThreadTest_3\src\main\java\frc\robot\Robot .java:36: error: class Robot is public, should be declared in a file named Robot.java
public class Robot extends TimedRobot {

This doesn’t make any sense to me.

In the error output it seems the file is named Robot<space>.java. Probably double check that.

3 Likes

Do you have a Main.java file? I had an issue with an older project that didn’t convert correctly that was missing that file.

That was it. Thanks.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.