Skip to content
Sign upLog in
← Back to Community

I can't run any program except for the one provided to me.

Profile icon
RiyaJain

I am unable to run any programs except for the default Main.java program. I tried to create another .java program with a main method called Hiya.java. I also tried to create a class in my SRC folder with a main method. However, every time I press run, only the original Main.java program runs. What should I do?

Voters
Profile icon
RiyaJain
Comments
hotnewtop
Profile icon
Zavexeon

Not sure how to do it in Java, but you can write some code in the main file to load whatever file you want.

Profile icon
hayaodeh

Thanks

@Geocube101
for answering.
@RiyaJain
can you mark this post as answered, please.

Profile icon
Geocube101

Repl.it only runs the Main.java file

Profile icon
RiyaJain

Huh, I didn't realize that. Thank you so [email protected]

Profile icon
Geocube101

@RiyaJain
You're welcome

Profile icon
NishantTyagi1

@Geocube101
What you can do is, Open the Shell instead of console and then use "javac fileName.java && java fileName" to run main method from any file.