Skip to content
Sign upLog in
← Back to Community

How do I fix a "Could not find or load main class Main" error?

Profile icon
SHANEKASNER

Screenshot 2020-08-24 at 11.10.26 AM


Screenshot 2020-08-24 at 11.10.38 AM

Answered by PattanAhmed [earned 5 cycles]
View Answer
Voters
Profile icon
isal7222
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