Can't compile a java 9 project in IntelliJ IDEA with module-info

我与影子孤独终老i 提交于 2019-12-22 07:04:32

问题


Can't compile a java 9 project in IntelliJ IDEA with module-info.

  1. Create a project
  2. Add module
  3. Create a class with with a main (without module-info.java it runs)
  4. Add Module-info.java
  5. Run Main Fails

Configuration

Module-info

module httpexample { }

Error

Error:(1, 1) java: file should be on source path, or on patch path for module

Intellij Version

IntelliJ IDEA 2017.1.2 Build #IU-171.4249.39, built on April 25, 2017 JRE: 1.8.0_112-release-736-b16 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Mac OS X 10.11.1


回答1:


It appears to be a new issue caused by Java 9 update 166, I've reported it in YouTrack, please follow for updates:

  • IDEA-172212 Compile Error under JDK9-167



回答2:


I am using IntelliJ EAP 2017.2 build 1909.2 and this is not an issue anymore




回答3:


I have installed IntelliJ 2017.2 EAP and JDK 9 build 169 and opened my module system projects and it works fine, now my system info is:

IntelliJ IDEA 2017.2 EAP
Build #IU-172.2103.15, built on May 12, 2017
IntelliJ IDEA EAP User
Expiration date: June 11, 2017
JRE: 1.8.0_152-release-845-b3 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.4



来源:https://stackoverflow.com/questions/43722565/cant-compile-a-java-9-project-in-intellij-idea-with-module-info

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!