java缺省包详解_eclipse下访问缺省包的问题?

参考下这个:

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 !

--------------------

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值