Console issue with replit

Does anyone know how to type in the console on replit? part of my project requires making a new file and then code. Once all of that is done, my prof tells us to “Press the run button, then enter java Exercise 1 in the console”. When i get to this part, the run feature only lasts 5 seconds (even if im fast enough to type out java Exercise 1 nothing happens.) please help.

1 Like

Hey @Dylan223!

You can use a prybar template (a Repl template) or you can type it in the shell. I hope this helps!

@SalladShooter I’m still kind of new to coding and my prof isnt the best, what do you mean i can use a repl template? also i tried tying java Exercise1 Java Exercise1 and even javaExercise1 into the shell. The console runs then nothing prints.

java Exercise1 will attempt to execute Exercise1.class, java executes the source file (has limitations). Use the shell for this.
javac will compile it into Exercise1.class
If it is executing but your Exercise1.javawas blank it will be a no-op.


I see you made another topic that I presume contains the repl you are using. Simply execute with java Exercise1 then in the initial directory of the shell.

1 Like

Can you explain it a bit further? My prof is telling us to use the (replits default repl when creating a js repl) then create a another file do i need to copy the code to the file? If not how would i go about using the shell or console (this is my first time doing something like this)

Im still lost, can you explain it simpler? Sorry this is my first time doing something like this and my prof wont tell me how to get the print statement to work

Hello @Dylan223!

Instead of pressing the Run button, run javac path/to/ && java filename in the shell.


I have to be missing something then, is there anything i have to do in the file? like write a code that calls on the files? because thats my only other idea. nothing ive tried so far has worked. im new to this and was basically thrown head first in with no coding knowledge.

Could you provide a screenshot of your issue?

Could it be a no-op?

Hello @Dylan223!

Replit is automatically running the entrypoint “”, which is empty. You can change this by pressing the … on the Files sidebar, and press Show hidden Files. Open the .replit file, and change the entrypoint to “src/main/java/”.

I did that and tried running it again. Still not printing.

Even tried using the javac line

Try running kill 1 in the shell.

1 Like

Still nothing, could this just be an issue with replit or my laptop? (I have tried on different computers as well)

Interesting, try copy-pasting all the files to a new Java template.

okay give me a second to set up everything again

So new repl copied everything over, still only printed the main.js (hello world). Went into hidden files changed the entry to your suggestion. Tried all the statements in the shell that you suggested and only the main.js file is printing not the Exercise1 file

I have tested this and it works!
Please change your .replit file to:

compile = "javac -classpath .:target/dependency/* -d . $(find . -type f -name '')"
run = "java -classpath .:target/dependency/* Exercise1"
entrypoint = "src/main/java/"
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"]
deploymentTarget = "cloudrun"
1 Like

okay i deleted everything in the .replit file and pasted what you sent, what command did you put into the shell to make it print? or could you send a screenshot of what you did? i’m so close to just taking a 0 because of this