运行我的第一个Java应用程序时出现InvalidModuleDescriptorException [英] InvalidModuleDescriptorException when running my first java app
本文介绍了运行我的第一个Java应用程序时出现InvalidModuleDescriptorException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经开始学习Java,并在尝试运行第一个程序时遇到如下问题:
I have started learning Java and encountered a problem when trying to run my first program as given below:
public class HelloWorld {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Hello world!");
}
}
在Eclipse Photon上,运行它时遇到此错误:
On Eclipse Photon I encounter this error when running it:
Error occurred during initialization of boot layer
java.lang.module.FindException: Error reading module: C:\Users\Thomas\eclipse-workspace\HelloWorld\bin
Caused by: java.lang.module.InvalidModuleDescriptorException: HelloWorld.class found in top-level directory (unnamed package not allowed in module)
我看了看,bin目录中有我的.class文件,而 src
目录。
I looked and there is my .class file in bin directory and my .java in the src
directory.
那正常吗?我该如何解决?
Is that normal? How do I fix that?
推荐答案
我遇到了同样的错误。删除 module-info.java 文件为我解决了这个问题。
I was getting the same error. Deleting the module-info.java file solved it for me.
这篇关于运行我的第一个Java应用程序时出现InvalidModuleDescriptorException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文