IntelliJ: 初始化引导层时发生错误

huangapple go评论59阅读模式
英文:

IntelliJ: Error occurred during initialization of boot layer

问题

I receive the error:

Error occurred during initialization of boot layer
java.lang.module.FindException: Module com.example.test not found

Process finished with exit code 1

I have been looking for a solution myself but have not been able to find one as either they didn't apply/work. I noticed there were mentioning changing --module-path in the VM Options but this (--module-path) was nowhere in my VM options (I haven't touched VM options ever).

Under my java files and next to the folder com.example.test there is module-info.java which is just:

module com.example.test {
requires javafx.controls;
requires javafx.fxml;
requires java.desktop;

opens com.example.test to javafx.fxml;
exports com.example.test;
}

I'm not sure why it isn't working. It was working earlier in the morning on my current PC, I was able to run it at school on the school PC and a friend's laptop, but now I'm getting this error instead.

Thanks in advance.

英文:

I receive the error :

java.lang.module.FindException: Module com.example.test not found

Process finished with exit code 1

I have been looking for a solution myself but have not been able to find one as either they didn't apply/work. I noticed there were mentioning changing --module-path in the VM Options but this (--module-path) was nowhere in my VM options(I haven't touched VM options ever)

Under my java files and next to the folder com.example.test there is module-info.java which is just:

module com.example.test {
requires javafx.controls;
requires javafx.fxml;
requires java.desktop;

    opens com.example.test to javafx.fxml;
    exports com.example.test;

}

I'm not sure why it isn't working, It was working earlier in the morning on my current PC, I was able to run it at school on the school pc and a friend's laptop but now I'm getting this error instead.

Thanks in advance.

答案1

得分: 1

你正在使用Idea,创建一个新的JavaFX项目。我建议在这样做时选择Maven作为构建工具。然后你的模块将能够被正常找到。

此外,请确保你正在使用最新稳定版本的Maven和Idea,因为早期版本可能与Java模块系统的集成和理解质量不高。

更多信息请参考:

英文:

You are using Idea, create a new JavaFX project. I advise selecting Maven as the build tool when you do so. Then your module will be found with no problem.

Also, ensure that you are using the most recent stable versions of Maven and Idea as earlier versions may not have as high a quality integration with and understanding of the Java module system.

Further info is in the answer to:

答案2

得分: -1

好的,所以我回应是因为我让它“工作”了。我复制了项目并运行了复制,实际上它可以正常工作,只是原始的不能。如果有人找到“真正”的解决方案,知道了会很好。

英文:

Alright so I'm responding cuz I got it to "work". I copied the project and ran the copy which actually works, just the original doesn't. If anyone finds the "real" solution would be great to know.

huangapple
  • 本文由 发表于 2023年5月18日 05:10:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/76276226.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定