[英]java.lang.IllegalArgumentException: plexus.container.default: Invalid module name: 'default' is not a Java identifier
I've this issue when I'm trying to launch my jar with a script bash:当我尝试使用脚本 bash 启动我的 jar 时,我遇到了这个问题:
Complete issue :完整的问题:
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for C:\Users\aposk\Desktop\Twitter_App_Win_Version\app\ressources\lib\plexus-container-default-1.0-alpha-9-stable-1.jar
Caused by: java.lang.IllegalArgumentException: plexus.container.default: Invalid module name: 'default' is not a Java identifier
script bash脚本重击
@echo off ::apt-get install openjfx SET JAVA_HOME=C:\\Users\\aposk\\Desktop\\Twitter_App_Win_Version\\jdk-13.0.1 SET PATH=%JAVA_HOME%\\bin;%PATH% java -version java -jar --module-path "C:\\Users\\aposk\\Desktop\\Twitter_App_Win_Version\\app\\ressources\\lib" --add-modules=javafx.controls,javafx.fxml "C:\\Users\\aposk\\Desktop\\Twitter_App_Win_Version\\app\\ressources\\pip-0.0.1-SNAPSHOT.jar" pause
We are working on JDK 13 but works on JDK too --> cause of Http request by import of java.net.我们正在研究 JDK 13,但也适用于 JDK --> 通过导入 java.net 导致 Http 请求。
I'm on Win-64bits et works on eclipse with maven.我在 Win-64bits 上,使用 maven 在 Eclipse 上工作。 Others solutions on web didn't fix my issue网络上的其他解决方案没有解决我的问题
Back with solution!回来解决!
If you need ton run your .jar with JFX a newer version than JAVA 8, you need to set up your system with the jdk, but also you need to create a new main class without extend on APplication.如果您需要使用 JFX 运行比 JAVA 8 更新的版本的 .jar,您需要使用 jdk 设置您的系统,但您还需要创建一个新的主类而不扩展应用程序。 In this class you'll run your mainApp with a public void method and you need to add some arguments in you pom.xml (feg)在本课程中,您将使用 public void 方法运行 mainApp,并且需要在 pom.xml (feg) 中添加一些参数
<groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2.4.1</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <shadedArtifactAttached>true</shadedArtifactAttached> <shadedClassifierName>project/classifier</shadedClassifierName> <outputFile>shade\\${project.artifactId}.jar</outputFile> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>fr.tse.fise2.pip.graphic.Main</mainClass> </transformer> </transformers> </configuration> </execution> </executions>
You also need do configure some module for java fx in you pom.xml您还需要在 pom.xml 中为 java fx 配置一些模块
<dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-base</artifactId> <version>13</version> </dependency> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-controls</artifactId> <version>13</version> </dependency> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-graphics </artifactId> <version>13</version> <classifier>mac</classifier> </dependency> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-graphics </artifactId> <version>13</version> <classifier>linux</classifier> </dependency> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-graphics </artifactId> <version>13</version> <classifier>win</classifier> </dependency> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-fxml</artifactId> <version>13</version> </dependency> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-web</artifactId> <version>13</version> </dependency> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-controls</artifactId> <version>13</version> </dependency> <!-- https://mvnrepository.com/artifact/org.openjfx/javafx-fxml --> <dependency> <groupId>org.openjfx</groupId> <artifactId>javafx-fxml</artifactId> <version>13</version> </dependency> <!-- https://mvnrepository.com/artifact/com.jfoenix/jfoenix --> <dependency>
Now you can run you jar with cmd java -jar filename.jar at the correct location of your jar现在您可以在 jar 的正确位置使用 cmd java -jar filename.jar 运行您的 jar
My projects works with JavaFx and JAVA 11我的项目适用于 JavaFx 和 JAVA 11
Helped by Kamil在卡米尔的帮助下
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.