在module-info.java中导出模块时出错->包为空:项目 [英] error while exporting module in module-info.java -> Package is empty: projects

查看:115
本文介绍了在module-info.java中导出模块时出错->包为空:项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在继续之前,请看下面的图片:

Before continuing, take a look on the image below:

关于为什么我无法导出与我在module-info.java中声明的模块相同的模块的任何想法?

Any thoughts on why I'm unable to export the same module as my declared module in the module-info.java?

P.S:突出显示的错误消息与该主题无关.但是,如果您对此错误有任何提示,请尝试回答

P.S: The highlighted error message has nothing to do with this topic. But if you have any hint on this error, try answering this stackoverflow topic

提前谢谢!

推荐答案

轻微更正,您可以使用 exports 指令用于软件包非模块. JLS7中详细说明了声明语法.7

Slight correction, you can use the exports directive for packages and not modules. The declaration syntax is detailed in JLS7.7 as

exports PackageName [to ModuleName {, ModuleName}] ;

其他几行代码(由 exports ... 组成)符合该行为,并且似乎正在编译.上述行中失败的原因是因为软件包 projects 为空,并且Java模块系统不允许导出空软件包.

Other few lines of your code(consisting of exports ...) comply with the behavior and seems to be compiling. The reason for the failure on the mentioned line is because the package projects is empty and empty packages are not allowed to be exported by the java module system.

这篇关于在module-info.java中导出模块时出错->包为空:项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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