英文:
Module xxx not found, required by xxx
问题
我正在尝试在Eclipse 2020-06中使用Java 14构建一个小程序。我有Guava 29作为一个依赖项。这是我的 module-info.java
文件内容:
module xxx {
exports main;
requires java.base;
requires java.desktop;
requires java.prefs;
requires com.google.common;
}
然而,当我启动程序时,我收到以下消息:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module com.google.common not found, required by xxx
Guava的JAR文件已放置在Modulepath下。我没有使用任何类似Maven等的构建工具。
在移除了 requires
后,我查看了编译器建议的内容。以下是编译器建议的 requires
部分,但我之前已经添加过了。
查看:链接
英文:
I'm trying to build a small program in Eclipse 2020-06 using Java14. I have Guava 29 as a dependency. Here is my module-info.java
module xxx {
exports main;
requires java.base;
requires java.desktop;
requires java.prefs;
requires com.google.common;
}
However, when I launch the program, I get this message:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module com.google.common not found, required by xxx
The guava jar is placed under Modulepath. I'm not using any build tools like Maven etc.
After removing the requires
, I checked what the compiler would suggest. Here is what the compiler suggests as a requires, but I already had it before.
See: https://prnt.sc/unp2hf
答案1
得分: 0
I've found a solution to the problem. First, move the dependencies to a folder called modules in your project's root folder and then add them to the modulepath.
Then, in the same window, click Source and edit the Default Output Folder to
> PROJECT_NAME/modules/MODULE_NAME
and happily launch the program.
英文:
I've found a solution to the problem. First, move the dependencies to a folder called
modules in your projects root folder. and then add them to the modulepath.
Then, in the same window, click Source and edit the Default Output Folder to
> PROJECT_NAME/modules/MODULE_NAME
and happily launch the program.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论