当我试图用脚本bash启动我的jar时,我遇到了这个问题:
全集:
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脚本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
我们正在研究JDK 13,但也在研究JDK
我正在使用Win-64位et在eclipse上使用maven。网络上的其他解决方案没有解决我的问题
发布于 2020-01-15 19:13:13
带着解决办法回来!
如果您需要使用JFX运行.jar (比JAVA 8更新的版本),那么您需要使用jdk来设置您的系统,但也需要创建一个新的主类,而无需在APplication上进行扩展。在这个类中,您将使用公共空方法运行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>
您还需要在pom.xml中为java配置一些模块。
<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>
现在,您可以使用cmd java -jar filename.jar在jar的正确位置运行jar。
我的项目使用JavaFx和JAVA 11。
卡米尔帮助
https://stackoverflow.com/questions/59693916
复制相似问题