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.
Hey! Thank s a lot. But I guess I worsen things by deleting Main. class file And now?
Huh? What do you mean by that?
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?
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 = "ArithmeticOperator.java" hidden = ["**/*.class"] [packager] language = "java" [packager.features] packageSearch = true [languages.java] pattern = "**/*.java" [languages.java.languageServer] start = "jdt-language-server" [unitTest] language = "java" [nix] channel = "stable-22_11" [debugger] support = true [debugger.compile] command = "javac -classpath .:/run_dir/junit-4.12.jar:target/dependency/* -g -d . $(find . -type f -name '*.java')" [debugger.interactive] transport = "localhost:0" connectTimeout = 60 startCommand = "java-debug" [debugger.interactive.initializeMessage] command = "initialize" type = "request" [debugger.interactive.initializeMessage.arguments] adapterID = "cppdbg" clientID = "replit" clientName = "replit.com" columnsStartAt1 = true linesStartAt1 = true locale = "en-us" pathFormat = "path" supportsInvalidatedEvent = true supportsProgressReporting = true supportsRunInTerminalRequest = true supportsVariablePaging = true supportsVariableType = true [debugger.interactive.launchMessage] command = "launch" type = "request" [debugger.interactive.launchMessage.arguments] classPaths = ["."] mainClass = "Main" [deployment] 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