Why does IntelliJ give me “Package doesn’t exist” error?

I’m trying to use the barbecue barcode printing library. I have successfully added the library to IntelliJ through project structure add library. Then I imported the packages and wrote the methods, which gave me no error. The packages were available in the class.

But when I compile it gives me the error:

error: package net.sourceforge.barbecue does not exist

How can this be?

I’m coding in ubuntu, is there any other place to which I have to add the library?

34 Answers
34

Just reimport didn’t work. Following worked for me.

File -> Invalidate Caches /Restart

Then

Build -> Rebuild Project

That will reimport maven project.

Note : You need to invalidate the cache AND ALSO rebuild the project.

Leave a Comment