Issue
I'm using Apache Netbeans 9.0 on Linux Mint and Git. I have a java project called PowerCal and while trying to run it, I get the following error:
run:
Error occurred during initialization of boot layer
java.lang.module.FindException: Error reading module: /<PATHTOMYPROJECT>/PorwerCal/build/classes
Caused by: java.lang.module.InvalidModuleDescriptorException: Truncated module-info.class
/home/<myusername>/.cache/netbeans/9.0/executor-snippets/run.xml:111: The following error occurred while executing this line:
/home/<myusername>/.cache/netbeans/9.0/executor-snippets/run.xml:68: Java returned: 1
BUILD FAILED (total time: 0 seconds)
I have no idea why this is happening, I ran this project before with no problems, but then I started creating some classes and after that I couldn't run it again. So I rolled the project back to the beginning, to the point it was working, but now it doesn't work.
Solution
The solution is this:
Which version of Java are you using? There is a fix for an InvalidModuleDescriptorException in Java 10, though obviously that does not necessarily relate to your problem. As suggested in the previous comment, just select the project's node, right click and select Clean and Build. Does that fix the issue? – skomisa
Answered By - Slart42
Answer Checked By - David Goodson (JavaFixing Volunteer)