Run a replit apart from Main

How to run a replit apart from Main? My code does not run.It just runs a main code that oututs hello world?

Hey @RIBAMILTOMBEZER, welcome to the community!

Just click the three dots then click “Show hidden files”. Next click on the .replit file and finally you can change the entrypoint to whatever file you want to run.

You can also change the second line from run="run_command_for_lang main.file_type" to run="run_command_for_lang fileIWantToRun.file_type", though it won’t have an effect for interpreted languages as shown in the comment on line 1.



Show hidden files


1 Like

Hey! Thank s a lot. But I guess I worsen things by deleting Main. class file :rofl: :rofl:And now?

Huh? What do you mean by that?

1 Like

I went straight to files and deleted the ones I didn’t want.
Guess I didn’t read your instructions like I should.

Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
exit status 1

Can you send a link to your Repl?

1 Like

Oh, Ok! Sure! I’ll do it !

I believe you should be able to restore the file by creating a file with the same name. This should restore its content back.


Hey, java is a bit different from other non-compiled languages, do you should just entirely replace .replit with this:

compile = "javac -classpath .:target/dependency/* -d . $(find . -type f -name '*.java')"
run = "java -classpath .:target/dependency/* ArithmeticOperator"
entrypoint = ""
hidden = ["**/*.class"]

language = "java"

packageSearch = true

pattern = "**/*.java"

start = "jdt-language-server"

language = "java"

channel = "stable-22_11"

support = true

command = "javac -classpath .:/run_dir/junit-4.12.jar:target/dependency/* -g -d . $(find . -type f -name '*.java')"

transport = "localhost:0"
connectTimeout = 60
startCommand = "java-debug"

command = "initialize"
type = "request"

adapterID = "cppdbg"
clientID = "replit"
clientName = ""
columnsStartAt1 = true
linesStartAt1 = true
locale = "en-us"
pathFormat = "path"
supportsInvalidatedEvent = true
supportsProgressReporting = true
supportsRunInTerminalRequest = true
supportsVariablePaging = true
supportsVariableType = true

command = "launch"
type = "request"

classPaths = ["."]
mainClass = "Main"

build = "javac -classpath .:target/dependency/* -d . $(find . -type f -name '*.java')"
run = "java -classpath .:target/dependency/* Main"

It worked out ! Thank you so much, guys! I’ll have to that to every new file ?

You can create new classes in new files, which you can then import into your

Go to .replit and change the file to start on run