本文介绍了如何解决“无法导出.jar文件的模块描述符" fxml中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从JAR库获取图像到我的项目.

I would like to get an image from JAR library to my project.

    <graphic>
        <ImageView>
            <Image url="@/toolbarButtonGraphics/general/TipOfTheDay24.gif"/>
        </ImageView>
    </graphic>

我已将库添加到模块中,这似乎是正确的,但是编译器会引发错误:启动层初始化期间发生错误java.lang.module.FindException:无法导出 filepath.jar 的模块描述符引起原因:java.lang.IllegalArgumentException:jlfgr.1.0:无效的模块名称:'1'不是Java标识符.这是我的模块信息文件:

I've added the library to my module and it seemed to be correct but the compiler throws an error:Error occurred during initialization of boot layerjava.lang.module.FindException: Unable to derive module descriptor for filepath.jarCaused by: java.lang.IllegalArgumentException: jlfgr.1.0: Invalid module name: '1' is not a Java identifier. Here's my module-info file:

requires javafx.fxml;
requires javafx.controls;

opens sample;

感谢您的帮助!

推荐答案

似乎您没有正确执行这些步骤.添加新库时,首先,将其添加到模块中,然后必须将其添加到您的模块中 module-info 文件.

it seems like you did not follow the steps properly. When you add a new library, first, you add it to your module and then you have to add it to youmodule-info file.

只需在module-info中添加一行---> requires <package-name>;

Just add a line in module-info---> requires <package-name>;

例如,我的包裹名称是 graphics-looks.jar ---> requires graphics-looks;

e.g my package name is graphics-looks.jar---> requires graphics-looks;

P.S.在将该jar添加到任何地方之前,请尝试对其进行重命名并通过从其名称中删除数字和其他字符来提供一个简单的名称.

P.S. before adding that jar anywhere, try to rename it and give a simple name by removing numbers and other characters from its name.

这篇关于如何解决“无法导出.jar文件的模块描述符" fxml中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 12:38