Error message run I tried to run the hello world in java [message #1809203] |
Thu, 11 July 2019 12:47  |
Eclipse User |
|
|
|
Why do I get this message when I tried to run a java program? What do I need to do so this won't continue to happen when I'm trying to run my Java program in Eclipse?
error occurred during initialization of boot layerjava.lang.module.findexception: error reading module: c:\coderepository\myproject\bincaused by: java.lang.module.invalidmoduledescriptorexception: myclass.class found in top-level directory (unnamed package not allowed in module)
|
|
|
|
|
|
Re: Error message run I tried to run the hello world in java [message #1855082 is a reply to message #1814050] |
Wed, 28 September 2022 03:42   |
Eclipse User |
|
|
|
I faced the same problem when I created the HelloWorld application for the second time (first time it worked, then I installed some other java IDE's). I run into errors while following step by step the instructions. I didn't know what to do and I reinstalled Eclipse. This did not help. I tried to reset to default most of the options and it also didn't help. Then I found this forum and I understood what was wrong. But it would be useful for the step by step instructions to include additional advice, such as what to type in the Package area in case it remains empty.
|
|
|
|
|
|
Re: Error message run I tried to run the hello world in java [message #1860930 is a reply to message #1809203] |
Sat, 09 September 2023 20:05   |
Eclipse User |
|
|
|
It's likely your project contains a file called module-info.java.
(This is a default file, but I don't know how to change the setting to not have it be automatically included in your project.)
Solution, right-click & delete the file ("module-info.java").
(See attached image.)
(Credit to Nitin Dahyabhai for his helpful suggestion!!)
|
|
|
|
Re: Error message run I tried to run the hello world in java [message #1860932 is a reply to message #1855082] |
Sat, 09 September 2023 20:35  |
Eclipse User |
|
|
|
Dear fellow newbie,
You are looking at the "Create New Class" dialog. Let's take a look at the "Create New Project" dialog instead. See image. As I mention in the image, the Create New Project dialog probably has "Create Module Info" (?) automatically checked.
Having "Create Module Info" checked seems to create extra work for the programmer. It seems to cause the compiler to expect that a "package" (whatever that means!) will be specified by the programmer (you & me).
When the new project is created, you'll see a file called "module-info.java" has been automatically added under the "src" folder.
That file ("module-info.java") is the problem. It puts the compiler into a "check package" mode (just a guess, as I don't really know what's going on).
Comment out the one-line command in that file, or right-click the file (from within the Project Explorer (?) and select "Delete" (to remove the module-info.java file from the project).
This worked for me, just within the last 20 minutes when I tried it out. Good luck!!
|
|
|
Powered by
FUDForum. Page generated in 0.13174 seconds