Unexpected "Package Does Not Exist" Errors

Hi,

If this is the wrong place to ask, I would appreciate your directions to the proper place.

I'm a fairly new user (a couple of months of experience with the program) and I ran into a strange problem: The compiler suddenly started throwing a "package does not exist" error on each and every "import" statement in my project. This naturally led to more errors about symbols that cannot be found.

I checked and rechecked my settings (the paths, for example) and everything is in order. The only "new" thing I've done recently is adding a content root external to the one I used up until now.

I think it's worth noting that there are no error marks (in red) in the editor windows, as I would have expected to be if the imports were indeed referring to packages that does not exist. The errors only appear when I compile.

I tried looking for a solution here and elsewhere but came up empty. Can anyone help?

Thank you,
Oren

4 comments

Did you accidentally exclude a directory from your compiler settings in
Project Settings -> Compiler?

"Oren W." <no_mail@jetbrains.com> wrote in message
news:19187541.1131280710678.JavaMail.itn@is.intellij.net...

Hi,

>

If this is the wrong place to ask, I would appreciate your directions to
the proper place.

>

I'm a fairly new user (a couple of months of experience with the program)
and I ran into a strange problem: The compiler suddenly started throwing a
"package does not exist" error on each and every "import" statement in my
project. This naturally led to more errors about symbols that cannot be
found.

>

I checked and rechecked my settings (the paths, for example) and
everything is in order. The only "new" thing I've done recently is adding
a content root external to the one I used up until now.

>

I think it's worth noting that there are no error marks (in red) in the
editor windows, as I would have expected to be if the imports were indeed
referring to packages that does not exist. The errors only appear when I
compile.

>

I tried looking for a solution here and elsewhere but came up empty. Can
anyone help?

>

Thank you,
Oren



0

No, I didn't, but the problem was solved -- I don't have a clue how.

Thanks.

0

I have this same problem and it appears to be a bug in IDEA (I am in build 6180). The problem seems to be triggered when I am running and debugging unit tests. The purported "missing package" is in a different module of my multi-module project. Nothing is red in editor or project view - only when I'm trying to do build. The only thing I can do to get rid of the problem is to blow away all my .IntelliJIdea60 settings (rename the directory - I am on ubuntu feisty fawn).. and starting all over with my settings, config, etc. But doing that once or twice a day has become very time-consuming. No exceptions in the inspector or system/idea.log file. Please advise..

0

Still happens.

I removed the imports, then re-imported them via IDEA's suggestion. There is no error in the file - it only seems to "notice" the error when compiling.

 

FWIW, I'm using the Eclipse compiler; the same file runs flawlessly in Eclipse itself, however..

 

My info:

IntelliJ IDEA 2017.3.2 (Community Edition)
Build #IC-173.4127.27, built on December 25, 2017
JRE: 1.8.0_152-release-1024-b8 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.10.0-40-generic

My package structure (all inside the same Gradle subproject) was:

net.my.package
-MainClass.java

net.my.package.sub
-ClassWhichMainClassDependsOn.java

 Gradle structure is:

Main project
- subproject 1
- subproject 2
- subproject 3 (etc)

 

I tried moving the classes in net.my.package.sub to a different package, to no avail.

Ended up having to Invalidate Caches & Restart, which fixed it. No further issues, but it's only been a couple hours..

0

Please sign in to leave a comment.