Run issue on java

When i try to run anything, it shows the same error, Does anybody know how to fix this? i already tried entering the options that they provided but it still displays an error; I’ve been with this issue for two days now.

Hello @belenhervas01!
Try selecting any of the options (up and down arrow keys). This should install the command java.

2 Likes

They say that that failed:

@belenhervas01 could you provide that error?

when i select the options that appear this shows up:

Hi @belenhervas01 !
Are you using the official Java template by replit?

3 Likes

Hey @belenhervas01!

Could you show us your .replit file? To open it go to Files > and across from it click the three dots and then click Show Hidden Files, then you should be able to scroll down and find .replit in your files tab.

2 Likes

when i use that yes it works but just in the console, not in shell,

what do i have to type in the console so it would print the main file?



@belenhervas01 the reason the problem is happening is because of the naming of your Javafile (HelloWorld.java) you could change the file name to be Main.java or fix it via the .replit file. To open this, inside of your Repl click on the three dots next to where Files > is. Click Show Hidden Files and go to the .replit file, now scroll down to run = and entrypoint = and change them to this

run = "java -classpath .:target/dependency/* HelloWorld"
entrypoint = "src/main/java/HelloWorld.java" 

I hope this helps!

i get this message when i run the code…

Please open your replit.nix file, and remove all the incorrect lines.

2 posts were split to a new topic: Files not loading

Instead of using java Main.java

first copy the path to Main.java it should be something like src/main/java/Main.java as @SalladShooter provided for the entry point.

then, back in the shell write java and then paste the path and hit enter
so
java src/main/java/Main.java

Alternatively, you could use the change directory cd command to change the working directory to src/main/java/
Then you could use java Main.java and not have to enter in the longer path everytime.

In the shell , enter, cd src/main/java
Then enter java Main.java


Also it seems that it did actually give the desired output, (Hello World!,) when you added zulu to replit.nix, it just was preceded by the error could not verify and get…


and then it didn’t work when you tried java HelloWorld.java again after that. Though this may be besides the point since you’re specifically asking about addressing the errors, not just getting it to show the output.

3 Likes

Thank you so much; that helped :slight_smile: <3

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.