How to get rid of target dependency in Java

Whenever I create a new replit and delete the pre-loaded “Hello World” program, my new program will not run. It will only run what was pre-loaded ; “Hello World”.

Hey, @perezaj16 welcome to the forums.

Can we have the link to the repl so we can assist you?

absolutely

https://replit.com/join/eykcsbeytf-perezaj16

Not sure on this one but I think the .replit file is configured so a hidden file is running instead of FancyHello.java.

Yeah, its super strange

and everytime I create a new replit, it pre-loads the hello world program

I think every new repl made with an official template has a hello world program in it by default. I am going to do some research into your problem a little later when I have time.

Sounds good, thank you

Im not sure what was causing it. What I did was make a new repl with the official java template and then copy and pasted your code for the fancy Hello world. I also renamed the file and did not need to change anything in any hidden files like the .replit file. View my repl.

when you say “official java template” what are you referring to?

because when I create a new repl, it asks for what language, and the name I want to give my repl, then auto-populates the hello world program.

When you you make a repl it uses a template. All the popular languages have official templates.

Hi @perezaj16 I had a look at your replit and after showing the hidden files realised two things:

  1. When you ran the repl a file Main.class was created / already existed from previous use
  2. The .replit file was looking for the “Main.java” file.

I’ve added two comments to the Replit to show where I changed your code. Hope it helps!