Error: Module java.base not found, required by while trying jlink on Fedora
Error: Module java.base not found, required by while trying jlink on Fedora
尝试通过此插件在 Fedora 上使用 jlink 时 https://github.com/openjfx/javafx-maven-plugin
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
Pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.alcamech</groupId>
<artifactId>jomo</artifactId>
<version>1.0-SNAPSHOT</version>
<name>jomo</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>5.7.1</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>17.0.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>17.0.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>17.0.0.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<compress>2</compress>
<noHeaderFiles>true</noHeaderFiles>
<stripDebug>true</stripDebug>
<noManPages>true</noManPages>
<launcher>jomo</launcher>
<mainClass>com.alcamech.jomo/com.alcamech.jomo.Jomo</mainClass>
<jlinkImageName>jomo</jlinkImageName>
<jlinkZipName>jomo</jlinkZipName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
模块-info.java
module com.alcamech.jomo {
requires javafx.controls;
requires javafx.fxml;
requires javafx.media;
opens com.alcamech.jomo to javafx.fxml;
exports com.alcamech.jomo;
}
我收到以下错误
Error: Module java.base not found, required by com.alcamech.jomo
运行 java --list-modules
returns.
java.base@11.0.13
java.compiler@11.0.13
java.datatransfer@11.0.13
java.desktop@11.0.13
java.instrument@11.0.13
java.logging@11.0.13
java.management@11.0.13
java.management.rmi@11.0.13
java.naming@11.0.13
java.net.http@11.0.13
java.prefs@11.0.13
java.rmi@11.0.13
java.scripting@11.0.13
java.se@11.0.13
java.security.jgss@11.0.13
java.security.sasl@11.0.13
java.smartcardio@11.0.13
java.sql@11.0.13
java.sql.rowset@11.0.13
java.transaction.xa@11.0.13
java.xml@11.0.13
java.xml.crypto@11.0.13
jdk.accessibility@11.0.13
jdk.aot@11.0.13
jdk.attach@11.0.13
jdk.charsets@11.0.13
jdk.compiler@11.0.13
jdk.crypto.cryptoki@11.0.13
jdk.crypto.ec@11.0.13
jdk.dynalink@11.0.13
jdk.editpad@11.0.13
jdk.hotspot.agent@11.0.13
jdk.httpserver@11.0.13
jdk.internal.ed@11.0.13
jdk.internal.jvmstat@11.0.13
jdk.internal.le@11.0.13
jdk.internal.opt@11.0.13
jdk.internal.vm.ci@11.0.13
jdk.internal.vm.compiler@11.0.13
jdk.internal.vm.compiler.management@11.0.13
jdk.jartool@11.0.13
jdk.javadoc@11.0.13
jdk.jcmd@11.0.13
jdk.jconsole@11.0.13
jdk.jdeps@11.0.13
jdk.jdi@11.0.13
jdk.jdwp.agent@11.0.13
jdk.jfr@11.0.13
jdk.jlink@11.0.13
jdk.jshell@11.0.13
jdk.jsobject@11.0.13
jdk.jstatd@11.0.13
jdk.localedata@11.0.13
jdk.management@11.0.13
jdk.management.agent@11.0.13
jdk.management.jfr@11.0.13
jdk.naming.dns@11.0.13
jdk.naming.ldap@11.0.13
jdk.naming.rmi@11.0.13
jdk.net@11.0.13
jdk.pack@11.0.13
jdk.rmic@11.0.13
jdk.scripting.nashorn@11.0.13
jdk.scripting.nashorn.shell@11.0.13
jdk.sctp@11.0.13
jdk.security.auth@11.0.13
jdk.security.jgss@11.0.13
jdk.unsupported@11.0.13
jdk.unsupported.desktop@11.0.13
jdk.xml.dom@11.0.13
jdk.zipfs@11.0.13
当前
Fedora release 35 (Thirty Five), 5.15.13-200.fc35.x86_64
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment 18.9 (build 11.0.13+8)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.13+8, mixed mode, sharing)
我在遵循 https://openjfx.io/openjfx-docs/. Cloning my project repo on windows and running the jlink command is successful. I've tried the jlink command through the CLI on linux and got the same error. I've opened a github issue with a full maven log here https://github.com/openjfx/javafx-maven-plugin/issues/146
的示例项目(Modular Intellij,Modular CLI)时遇到了这个错误
从 mvn javafx:link 输出调试 jlink 命令行:
[DEBUG] Executing command line: [/usr/lib/jvm/java-11-openjdk/bin/jlink, --module-path, /home/alcamech/Development/jomo/target/classes:/home/alcamech/.m2/repository/org/openjfx/javafx-base/17.0.0.1/javafx-base-17.0.0.1-linux.jar:/home/alcamech/.m2/repository/org/openjfx/javafx-controls/17.0.0.1/javafx-controls-17.0.0.1-linux.jar:/home/alcamech/.m2/repository/org/openjfx/javafx-fxml/17.0.0.1/javafx-fxml-17.0.0.1-linux.jar:/home/alcamech/.m2/repository/org/openjfx/javafx-graphics/17.0.0.1/javafx-graphics-17.0.0.1-linux.jar:/home/alcamech/.m2/repository/org/openjfx/javafx-media/17.0.0.1/javafx-media-17.0.0.1-linux.jar, --add-modules, com.alcamech.jomo, --output, /home/alcamech/Development/jomo/target/image, --compress, 0]
我的 jdk 中缺少 jmods 目录。在 Fedora 上,jmods 是单独安装的
https://fedora.pkgs.org/35/fedora-x86_64/java-11-openjdk-jmods-11.0.12.0.7-4.fc35.x86_64.rpm.html
运行 sudo dnf install java-11-openjdk-jmods
尝试通过此插件在 Fedora 上使用 jlink 时 https://github.com/openjfx/javafx-maven-plugin
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
Pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.alcamech</groupId>
<artifactId>jomo</artifactId>
<version>1.0-SNAPSHOT</version>
<name>jomo</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>5.7.1</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>17.0.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>17.0.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>17.0.0.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<compress>2</compress>
<noHeaderFiles>true</noHeaderFiles>
<stripDebug>true</stripDebug>
<noManPages>true</noManPages>
<launcher>jomo</launcher>
<mainClass>com.alcamech.jomo/com.alcamech.jomo.Jomo</mainClass>
<jlinkImageName>jomo</jlinkImageName>
<jlinkZipName>jomo</jlinkZipName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
模块-info.java
module com.alcamech.jomo {
requires javafx.controls;
requires javafx.fxml;
requires javafx.media;
opens com.alcamech.jomo to javafx.fxml;
exports com.alcamech.jomo;
}
我收到以下错误
Error: Module java.base not found, required by com.alcamech.jomo
运行 java --list-modules
returns.
java.base@11.0.13
java.compiler@11.0.13
java.datatransfer@11.0.13
java.desktop@11.0.13
java.instrument@11.0.13
java.logging@11.0.13
java.management@11.0.13
java.management.rmi@11.0.13
java.naming@11.0.13
java.net.http@11.0.13
java.prefs@11.0.13
java.rmi@11.0.13
java.scripting@11.0.13
java.se@11.0.13
java.security.jgss@11.0.13
java.security.sasl@11.0.13
java.smartcardio@11.0.13
java.sql@11.0.13
java.sql.rowset@11.0.13
java.transaction.xa@11.0.13
java.xml@11.0.13
java.xml.crypto@11.0.13
jdk.accessibility@11.0.13
jdk.aot@11.0.13
jdk.attach@11.0.13
jdk.charsets@11.0.13
jdk.compiler@11.0.13
jdk.crypto.cryptoki@11.0.13
jdk.crypto.ec@11.0.13
jdk.dynalink@11.0.13
jdk.editpad@11.0.13
jdk.hotspot.agent@11.0.13
jdk.httpserver@11.0.13
jdk.internal.ed@11.0.13
jdk.internal.jvmstat@11.0.13
jdk.internal.le@11.0.13
jdk.internal.opt@11.0.13
jdk.internal.vm.ci@11.0.13
jdk.internal.vm.compiler@11.0.13
jdk.internal.vm.compiler.management@11.0.13
jdk.jartool@11.0.13
jdk.javadoc@11.0.13
jdk.jcmd@11.0.13
jdk.jconsole@11.0.13
jdk.jdeps@11.0.13
jdk.jdi@11.0.13
jdk.jdwp.agent@11.0.13
jdk.jfr@11.0.13
jdk.jlink@11.0.13
jdk.jshell@11.0.13
jdk.jsobject@11.0.13
jdk.jstatd@11.0.13
jdk.localedata@11.0.13
jdk.management@11.0.13
jdk.management.agent@11.0.13
jdk.management.jfr@11.0.13
jdk.naming.dns@11.0.13
jdk.naming.ldap@11.0.13
jdk.naming.rmi@11.0.13
jdk.net@11.0.13
jdk.pack@11.0.13
jdk.rmic@11.0.13
jdk.scripting.nashorn@11.0.13
jdk.scripting.nashorn.shell@11.0.13
jdk.sctp@11.0.13
jdk.security.auth@11.0.13
jdk.security.jgss@11.0.13
jdk.unsupported@11.0.13
jdk.unsupported.desktop@11.0.13
jdk.xml.dom@11.0.13
jdk.zipfs@11.0.13
当前
Fedora release 35 (Thirty Five), 5.15.13-200.fc35.x86_64
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment 18.9 (build 11.0.13+8)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.13+8, mixed mode, sharing)
我在遵循 https://openjfx.io/openjfx-docs/. Cloning my project repo on windows and running the jlink command is successful. I've tried the jlink command through the CLI on linux and got the same error. I've opened a github issue with a full maven log here https://github.com/openjfx/javafx-maven-plugin/issues/146
的示例项目(Modular Intellij,Modular CLI)时遇到了这个错误从 mvn javafx:link 输出调试 jlink 命令行:
[DEBUG] Executing command line: [/usr/lib/jvm/java-11-openjdk/bin/jlink, --module-path, /home/alcamech/Development/jomo/target/classes:/home/alcamech/.m2/repository/org/openjfx/javafx-base/17.0.0.1/javafx-base-17.0.0.1-linux.jar:/home/alcamech/.m2/repository/org/openjfx/javafx-controls/17.0.0.1/javafx-controls-17.0.0.1-linux.jar:/home/alcamech/.m2/repository/org/openjfx/javafx-fxml/17.0.0.1/javafx-fxml-17.0.0.1-linux.jar:/home/alcamech/.m2/repository/org/openjfx/javafx-graphics/17.0.0.1/javafx-graphics-17.0.0.1-linux.jar:/home/alcamech/.m2/repository/org/openjfx/javafx-media/17.0.0.1/javafx-media-17.0.0.1-linux.jar, --add-modules, com.alcamech.jomo, --output, /home/alcamech/Development/jomo/target/image, --compress, 0]
我的 jdk 中缺少 jmods 目录。在 Fedora 上,jmods 是单独安装的
https://fedora.pkgs.org/35/fedora-x86_64/java-11-openjdk-jmods-11.0.12.0.7-4.fc35.x86_64.rpm.html
运行 sudo dnf install java-11-openjdk-jmods