Community
Participate
Working Groups
I have the following situation in build M4 (it works fine in M3): I have created two Java Projects test1 and test2. Each project has a src-folder for the classes and bin-folders for the class files. In test1 I have a class Test1.java in the 'default package' and in test2 I have a class Test2.java in the package 'test'. The project test2 has test1 on its build path. When I try to create an instance of Test1 from Test2's constructor it cannot resolve Test1 and I cannot import Test1 from Test2. (If Test2 is also in the 'default package' it works just fine.)
Sounds expected to me. I don't think the default package can be exported across projects. Moving to JDT for further comment.
I guess your compiler compliance level is 1.4. See Preferences>Java>Compiler>Compliance and Class files. This is normal. It is not possible anymore to import default package inside a package using javac 1.4. This was a bug that has been fixed in 1.4. If you set your compiler compliance level to 1.3, it will work. It is actually much better to put your class in a package than leaving it in the default package.
Indeed this is 1.4 spec'ed behavior.
*** Bug 60524 has been marked as a duplicate of this bug. ***
*** Bug 72361 has been marked as a duplicate of this bug. ***
*** Bug 77004 has been marked as a duplicate of this bug. ***