Eclipse - 添加module-info.java时找不到模块 [英] Eclipse - module not found when adding module-info.java

查看:2681
本文介绍了Eclipse - 添加module-info.java时找不到模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在eclipse中有一个简单的hello world项目,我希望用java 9运行。当我没有 module-info.java 文件时,程序运行但是当我添加该文件时,我收到以下错误:

I have a simple hello world project in eclipse that I want to run with java 9. The program runs when I don't have a module-info.java file but when I add that file I get the following error:

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

重现步骤的步骤

1。创建一个新的maven项目

2.将编译器和构建路径jre更改为9 $
3.自动生成module-info.java

4.更新junit依赖项在junit到4.12如果eclipse抱怨

5.运行项目

Steps to reproduce
1. Create a new maven project
2. Change compiler and build path jre to 9
3. Auto generate module-info.java
4. Update junit dependency in junit to 4.12 if eclipse complains
5. Run the project

这是一个与日食相关的问题还是我在运行项目时遗漏了什么?

Is this an eclipse related issue or am I missing something when running the project?

我使用的FYI eclipse版本是Oxygen.1a版本(4.7.1a)

FYI eclipse version I use is Oxygen.1a Release (4.7.1a)

推荐答案

找到基于intellij输出的答案:)我不得不将类的位置添加到运行配置中的vm参数ons以及main的模块名称/路径。如下。有关 -m -p java -help 命令c $ c>

Found the answer based on intellij output:) I had to add the location of the classes to the vm arguments in the run configurations as well as the module name/path to main. like below. See the java -help command for more info regarding -m and -p

这篇关于Eclipse - 添加module-info.java时找不到模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆