The exception java.lang.module.InvalidModuleDescriptorException is caused by an unnamed package not allowed in a module. Check the JDK version of the project.
Error occurred during initialization of boot layer java.lang.module.FindException: Error reading module: F:\eclipse-workspace\Sample\bin Caused by: java.lang.module.InvalidModuleDescriptorException: SampleClass.class found in top-level directory (unnamed package not allowed in module)
The unnamed package is not allowed in the module with the latest JDK. We will get this error if the project is allowed for modules by creating module-info.java during the project creation phase. To avoid this kind of exception, move all the classes that are in the default package to some named packages.
Create a Package
Refactor the code to move the classes in unnamed packages to named ones.