Eclipse + Java:如何从默认包导入类? [英] Eclipse + Java: How do I import classes from the default package?

查看:386
本文介绍了Eclipse + Java:如何从默认包导入类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Entities包中有类,但是我仍然想要运行默认包中的import东西,我该怎么做?

解决方案

你不会。



对不起,



引用其他答案,您可以查看 ORACLE参考,表示这是行为。



我建议将您的东西移动到命名包。



如果绝对不能重新确定,可以尝试使用反射访问它再次检查以上链接的答案。


I have classes in an Entities package, but I still want to run import stuff that is in the default package... how do I do that?

解决方案

You don't.

Sorry.

Though I'm quoting the other answer, you can check out the ORACLE reference that says that that is intended behaviour.

I recommend moving your stuff to a named package.

If you absolutely cannot re-factor, you can try using reflection to access it. Again, check the answer linked above.

这篇关于Eclipse + Java:如何从默认包导入类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆