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!"); } }
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)
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?
I was getting the same error. Deleting the module-info.java file solved it for me.
It seems that you haven't created a package. My usual procedure in Eclipse is:
Eclipse will help you a lot with the settings. Then just copy your code into that class and hit the 'start' button.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With