'Eclipse asking for module named after the old project name

I'm trying to make my project modular on Eclipse, but I'm running into an issue. I have added the module-info.java file through right-clicking on the project > Configure > Create module-info.java. However, when I run, I get the error

Error occurred during initialization of boot layer
java.lang.module.FindException: Module serenitea-pot-manager not found

I believe this might be caused by having renamed the project to sereniteaPotManager at some point. Initially, the project name was serenitea-pot-manager, which is the name of the module being asked for. I did the renaming through right-clicking on the project > Refactor > Rename..., which should have updated all instances.

I have been searching for a while, but still haven't found a way to fix this. Is there anything else that I need to update on Eclipse for it to change to the correct module name?

Note: The module name included in module-info.java is indeed sereniteaPotManager.



Solution 1:[1]

I had the same problem. I will summarize my experience then my solution.

I did a rename of the module, and Eclipse kept wanting to use the old module name. Cleans, restarts, etc., did not help. A search of the project properties, the run configuration, and all files in the workspace, did not turn up an instance of the original module name. Editing the module name so that it matched the original one did work. It is as if Eclipse tucks away the initial module name in some hidden place and keeps wanting to use it.

I was able to solve the problem by deleting all Run configurations that existed and then creating a new project and new Run configuration.

I am using JavaFX, and a somewhat peculiar side-effect of this is that the normally-required run configuration argument (below) was not needed in this new run configuration. I wonder if Eclipse is tucking that away in some hidden place, also?

Solution 2:[2]

In Java, serenitea-pot-manager is an invalid module name since a module name must not contain hypens (-).

Therefore, In module-info.java, Eclipse shows Syntax error on token "-". So make sure, before running your application, no compile errors are shown in the Problems view.

Rename your module to serenitea_pot_manager, delete the existing launch configuration (in Run > Run Configurations...) and try again:

module serenitea_pot_manager {
    // ...
}

Solution 3:[3]

https://stackoverflow.com/users/17416717/stevevzzz[Steves] solution worked for me while I got stuck with the same problem.

... but I did not create a new project. I only was able to solve the problem by deleting all Run Configurations that existed and then I created a new Run Configuration.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SteveVZZZ
Solution 2 howlger
Solution 3 Wilbury