Module xxx not found, required by xxx

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

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.

Module xxx not found, required by xxx

Then, in the same window, click Source and edit the Default Output Folder to

> PROJECT_NAME/modules/MODULE_NAME

Module xxx not found, required by xxx

and happily launch the program.

huangapple
  • 本文由 发表于 2020年9月25日 19:42:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/64063453.html
匿名

发表评论

匿名网友

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

确定