Can't get started (HelloWorld tutorial) [message #1866057] |
Mon, 20 May 2024 23:52  |
Eclipse User |
|
|
|
I'm totally new to Java and Eclipse, but trying to help my kids with a beginner Java course. We installed the latest version of Eclipse (May 20, 2024), and followed the Hello World tutorial that came up, but we're getting an error we don't understand. Here is my program and the error, but see attached screenshots also.
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
Error: Could not find or load main class test2.Test2
Caused by: java.lang.ClassNotFoundException: test2.Test2
There was originally a module-type thing showing up under HelloWorld, but I right-click-deleted it based on reading some other posts here, but it didn't help.
The funny thing is, I tried 3 different computers. This error is from a PC with Windows 10. I got the same error on a PC with Windows 7. But on a different PC with Windows 10 the same program ran fine .
Thank you!
|
|
|
|
Re: Can't get started (HelloWorld tutorial) [message #1866195 is a reply to message #1866132] |
Wed, 22 May 2024 10:40  |
Eclipse User |
|
|
|
You cannot define a class without a package in a project with a module because Java doesn't allow modules to contain unnamed packages. You must delete the module-info.java or create the class with a package.
[Updated on: Wed, 22 May 2024 10:44] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.06344 seconds