默认包'。' Import-Package语法不允许 [英] The default package '.' is not permitted by the Import-Package syntax

查看:1689
本文介绍了默认包'。' Import-Package语法不允许的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用Intellij IDEA运行@ org.junit.Test。

Trying to run @org.junit.Test with Intellij IDEA.

这是一个OSGi包,当点击Run'testMyTest'

It's an OSGi bundle, when hit Run 'testMyTest'

获得以下异常:

Error:osgi: [b2b-bundle] The default package '.' is not permitted by the Import-Package syntax. 
    This can be caused by compile errors in Eclipse because Eclipse creates 
    valid class files regardless of compile errors.
    The following package(s) import from the default package null

有人可以分享光在这个例外?

Could someone kindly share light on this exception?

谢谢,
彼得

推荐答案

您可能没有将您的课程放在包裹内。

You probably didn't place your class inside a package.

添加

package your_package_name;

位于.java文件的顶部,你应该很好。

at the top of your .java file and you should be good.

PS:根据您的包裹名称,您可能需要将文件移动到其他位置

PS: Depending on your package name, you may need to move the file to some other location as well

这篇关于默认包'。' Import-Package语法不允许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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