Removing Java Modules


What are Modules?

Java programming solutions are always organized inside of a Project which contains Classes which contains Methods. However, Java offers even more code organization using Packages and Modules. Packages are collections which organize multiple classes, and modules are a way to organize a collection of related packages. At this early stage of software development, we are not concerned with this level of organization, and instead we focus on the very basics. With this in mind, we encourage everyone to stick with using the Default Package for Classes and Do not Create Modules for your Java Projects.

How to Remove a Module

Modules may cause the following kind of error.



Hovering the mouse cursor over the error we see the following message “Must declare a named package because this compilation unit is associated to the named module ‘AProgram’”.



This error occurs when creating a class using the default package in a project that has a module. We can see this project includes a module by noticing the file “”.


In order to best fix this problem we can take the following steps.

1.      Delete the module (the file “”) from your project.

2.      Then restart Eclipse.

3.      Once it has restarted the project will not have an error.