我从https://github.com/restfb/restfb-examples打开RestFB示例,这是用Java编写的Facebook Graph API客户端,但我不能在netbeans或inteliJ中运行它。
在netbeans中的madule.info.java文件中,第一行可能是模块定义,如下所示:
module com.restfb.example {
// Java FX modules
requires javafx.web;
requires javafx.controls;
requires javafx.fxml;
// logging modules
requires java.logging;
requires jul.to.slf4j;
// other modules
requires restfb;
requires jfxrt;
requires rt;
exports com.restfb.example;
}
我有一个错误看起来像IDE上显示的语法错误,如下所示:
中的-source 8不支持
模块(使用-source 9或更高版本来启用模块)
我在NetBeans IDE 12中打开项目,并使用jdk1.8, 1.11, 1.15进行测试,但结果相同。
我用InteliJ IDEA测试,编译前没有错误,但是输出有一些错误
thsnks
右键单击Project -> Properties -> Sources -> Source/Binary Format
设置为大于8的值。
Java模块在Java 9中被引入。