Output bugs in java

Question:
everytime i run my code the output is always Hello world
Repl link:

code snippet
1 Like

Hi @John-AldrinAld1 , welcome to the forums!
Have you created another file (other than main.java) and want that file to run?

2 Likes

Hey @John-AldrinAld1!

Just click the next to “Files” 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.java" to run="run_command_for_lang fileIWantToRun.java", though it won’t have an effect for languages with interpreters as shown in the comment on line 1.

Images

Dots

Show hidden files

edited

Also see the docs on how to configure a Repl: https://docs.replit.com/programming-ide/configuring-repl

Hope this helps!

2 Likes

Hi @John-AldrinAld1 !
Are you facing any problems with the steps I mentioned? Do you need any help?

1 Like

Hi Nate,
I’m having issues with this aswell.
I followed your instructions but it doesn’t seem to do anything.
I get the same Hello World.

1 Like

Hi @BennyMoran , welcome to the forums!
Could you send the link to your repl?

1 Like

I posted the link. It says it’s waiting approval. I don’t know if there is a way to send it directly.

1 Like

Hi @BennyMoran && @John-AldrinAld1,

You guys are using Java, so changing the entrypoint won’t change the file to run. Instead, you will need to change line 2, where the run command is set. Change “Main” to the name of the file you want to run.

@BennyMoran in your case it would be:

run = "java -classpath .:target/dependency/* TextGame"
2 Likes

Thank you so very much! That worked perfectly!!

2 Likes

BennyMoran isn’t OP. He can’t mark the post as the solution.

1 Like