Skip to content
← Back to Community
How do I fix a "Could not find or load main class Main" error?
Profile icon
SHANEKASNER
Answered by PattanAhmed [earned 5 cycles]
View Answer
Voters
Profile icon
AditiSwaminatha
Profile icon
MadhavshivCS
Profile icon
elysium001
Profile icon
KatherineMahe
Profile icon
ShahinazYasser1
Profile icon
SHANEKASNER
Comments
hotnewtop
Profile icon
PattanAhmed

@SHANEKASNER Hi,
It seems like your code that you have written should be transferred to file name called Main.java
Try!
Thanks!

Hope this helps

Profile icon
CodeLongAndPros

Your code needs to be in Main.java

Profile icon
Coder100

Hello, two ways:

  1. Copy all your code into Main.java
  2. Configure the run button:
    Create a .replit file:
run="sh main.sh"

Create a main.sh file:

javac ExpressionsWithLiterals.java RectangleArea.java java ExpressionsWithLiterals