Package name 'Foo' does not correspond to the file path '' ??
I've created a default new J2SE 1.4 project Foo and new single package Foo and a single Module FooModule.
Each .java file declares the same package header, ie: package Foo;
The app compiles and runs fine.
But none of my source symbols are getting picked up by the editor's builtin lexical scanner dealie ('cannot resolve symbol xxx' litter the code).
The hint I'm getting from the IDE is that when I hover over the package declaration in each file I get the error:
'Package name 'Foo' does not correspond to the file path ''
?
Please sign in to leave a comment.
You don't have your source directory setup correctly. It could be that
your package name and class name are the same. Also, it is pretty
standard that package names are lower case. So, you should have a source
directory setup(under Paths in Settings for Module FooModule) points to
the directory where your package structure is setup. So, if if class
foo.Foo is in src/foo/Foo the source directory should point to src.
Troy Dawson wrote:
--
"A man's ethical behavior should be based effectually on sympathy,
education, and social ties and needs; no religious basis is necessary.
Man would indeed be in a poor way if he had to be restrained by fear of
punishment and hope of reward after death."
[Albert Einstein, "Religion and Science", New York Times Magazine, 9
November 1930]
Thanks. Your answer sorta prompted me to the right fix for this noobie issue...
For some reason my Foo package source wasn't in a Foo directory under /src. Creating the Foo directory and moving the source into it fixed the issue.
For the record, I was facing the exact same problem and fixed it the following way:
- delete all files with extension *.eml and *.iml from the project folder
- delete all hidden directories called .idea
- remove the project from the start screen
- add the project again from scratch
- import all modules
It's working fine at the moment.
(IntelliJ IDEA 2016.2.3, Mac OS 10.11.6, existing Eclipse project, imported into the IDE).
Cheers,
Martin
@Martin Wunderlich thank you so much. It worked like a charm, saves lot of time.