Changes do not apply when I run my java project

Hello,

I’m new to replit, so sorry if my issue is already treated elsewhere or I don’t understand something obvious.
I use replit to host my Discord bot with JDA with a replit Java project. My program functions, but at one moment it stopped considering changes in my code. It runs the bot as if I didn’t change anything even if I comment all the code in my Main file. Is there a problem in the synchronization of the files with replit? How do I fix it?
My repl

Hi @Hevie welcome to the community.

In order for the community to suggest ideas to help you solve your code issue it would be useful to share a link to your Repl.

Any error messages that you see appear when you attempt to run your code would also be useful to share here.

3 Likes

Hello. Thanks for the advice, I added a link to my repl in the main post, but I don’t have any error messages, since the program runs correctly, just without my changes.

I have had a similar problem with Java projects of my own:
FakeOS
Java Test Lab

In the first project, I updated the code over a month ago, but it’s
still running an old version (I can tell because the project tells
you its current version when ran).

In the second project, it also wouldn’t run my changes. In this case,
I deleted the repl, made a new one with the same name, then changed
the name, and it still runs the old code.

In both cases, there are no error messages, nor anything else to suggest
something is wrong, and the old code (the one replit is running) was
deleted and replaced by the new code.

I think I may have found the root of the problem. Since all Java replits default to having their class named “Main”, this is the only one replit ever runs, whether or not a “Main” class exists. None of my repls have a class named “Main”, as it causes some problems when running the code from my PC. I don’t know if there is a way to change which class replit defaults to though (most places just run whatever class contains the main method, and don’t try running ones that don’t exist).

Hey @jikjikoplu!

You are correct, by default we run the “Main” class. There are two steps you can do to fix this:

  1. Show hidden files and remove the “Main.class” file to stop it from running
  2. Edit the “.replit” file as shown in this video: Loom | Free Screen & Video Recording Software | Loom

If you have any other questions please let me know!

1 Like

I meant to reply to the OP, @Hevie (my bad)

1 Like