尝试运行程序时,netbeans中出现错误:截断了module-info.class [英] Error in netbeans when try to run program: Truncated module-info.class

查看:80
本文介绍了尝试运行程序时,netbeans中出现错误:截断了module-info.class的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux Mint和Git上使用Apache Netbeans 9.0.我有一个名为 PowerCal 的Java项目,尝试运行该项目时,出现以下错误:

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.

推荐答案

解决方案是这样:

您正在使用哪个Java版本?Java 10中有一个针对InvalidModuleDescriptorException的修复程序,尽管显然它不一定与您的问题有关.如上一条注释中所建议,只需选择项目的节点,右键单击并选择清理并生成".这样可以解决问题吗?–斯科米萨

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

这篇关于尝试运行程序时,netbeans中出现错误:截断了module-info.class的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆