chawks312
chawks312

Reputation: 51

Error: Must declare a named package because this compilation unit is associated to the named module '*******'

I was trying to open a program I made before but for some reason the following error always appeared: Must declare a named package because this compilation unit is associated to the named module '********'

enter image description here

Upvotes: 4

Views: 24139

Answers (2)

Mudit Chauhan
Mudit Chauhan

Reputation: 21

An easy solution to this problem is to delete the module-info.java file present on your Project Explorer tab. Eclipse created this by default, and also, removing this will not affect any functionality of your program. So, go for it...

Upvotes: 2

songer168
songer168

Reputation: 1

I created a new package, and moved the error classes from the default package to new one, then the error disappeared !

Source: @ernest_k's comment

Upvotes: 0

Related Questions