简体   繁体   English

Eclipse + Java:如何从默认包中导入类?

[英]Eclipse + Java: How do I import classes from the default package?

我在Entities软件包中有类,但是我仍然想运行默认软件包中的导入内容...我该怎么做?

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. 尽管我引用了另一个答案 ,但是您可以查看ORACLE参考 ,该参考指出了预期的行为。

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. 再次,检查上面链接的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM