开发者社区> 问答> 正文

Error:java: 无效的标记: --add-exports=java.base/sun.net

Error:java: 无效的标记: --add-exports=java.base/sun.net.util=ALL-UNNAMED Hi, I am using flink 1.9 in idea. But when I run a unit test in idea. The idea reports the following error:"Error:java: 无效的标记: --add-exports=java.base/sun.net.util=ALL-UNNAMED". Everything is ok when I use flink 1.6. I am using jdk 1.8. Is it related to the java version?*来自志愿者整理的flink邮件归档

展开
收起
EXCEED 2021-12-08 14:45:46 3772 0
1 条回答
写回答
取消 提交回答
  • Hi I met the same problem before. After some digging, I find that the idea will detect the JDK version and choose whether to use the jdk11 option to run the flink maven building. if you are in jdk11 env, then it will add the option --add-exports when maven building in IDEA.

    For my case, I was in IntelliJIdea2019.2 which depends on the jdk11, and once I re-import the flink modules then the IDEA will add the --add-exports flag even if I removed all the flags in .idea/compile.xml explicitly. I noticed that the Intellij's JDK affected the flink maven building, so I turned to use the Intellij with JDK8 bundled, then the problem was gone.

    You can verify it, and if it's really the same. can just replace your IDEA with the pkg suffix with "with bundled JBR 8" in here [1]. Say if you are using MacOS, then should download the package "2019.2.4 for macOS with bundled JBR 8 (dmg)"

    Hope it works for you Thanks.

    [1]. https://www.jetbrains.com/idea/download/other.html*来自志愿者整理的flink邮件归档

    2021-12-08 15:01:12
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载
The Reactive Cloud Native Arch 立即下载
JAVA开发手册1.5.0 立即下载