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 ''

?

4 comments
Comment actions Permalink

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:

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 ''

?


--
"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]

0
Comment actions Permalink

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.

0
Comment actions Permalink

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

0
Comment actions Permalink

@Martin Wunderlich thank you so much. It worked like a charm, saves lot of time.

0

Please sign in to leave a comment.