参考下这个:
http://saloon.javaranch.com/cgi- ... p;f=12&t=005529
Author How to use class inside the default package inside other packages!!
samir ware
ranch hand
Member # 103632
posted 2008年4月9日 15:29
--------------------------------------------------------------------------------
Hi all,
I am using Eclipse 3.2 and I have created a project with some package structure along with the default package. I have one class in default package (DefaultClass.java) and I want to make the use of that class in any of the package (for e.g. com.my.test.MyClass) . Whenever I try to make the use of the class which is default package , its giving me compile time error . Its not able to reconise the class in default package. Is there anything that I am missing . I even tried to put import statement (import DefaultPackage.java) . But still the class is not getting reconised . Can anybody please tell me the solution for the same.
Thanks in advance,
Samir
--------------------------------------------------------------------------------
Posts: 118 | Registered: Jul 2005 | IP: Logged
Christophe Verre
bartender
Member # 112140
posted 2008年4月9日 17:11
--------------------------------------------------------------------------------
The import of the default package is forbidden since Java 1.4 (I think...). So you have to change your project settings to make it comply to Java 1.3 (Project/Properties/Java Compiler/JDK Standard : 1.3). Or even better, don't use the default package !
--------------------