问题
I would like to get an image from JAR library to my project.
<graphic>
<ImageView>
<Image url="@/toolbarButtonGraphics/general/TipOfTheDay24.gif"/>
</ImageView>
</graphic>
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 layer java.lang.module.FindException: Unable to derive module descriptor for filepath.jar Caused 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;
Thanks for any help!
回答1:
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 you module-info file.
Just add a line in module-info
---> requires <package-name>;
e.g my package name is graphics-looks.jar
---> requires graphics-looks;
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.
回答2:
Switch the project programming language, set it to version 11 on both sdk and language level. it worked for me.
来源:https://stackoverflow.com/questions/55829893/how-to-fix-unable-to-derive-module-descriptor-for-jar-file-error-in-fxml