小编Har*_*lis的帖子

Intellij 中的 JavaFX 和 Maven:JAVA_HOME 设置但“无法识别的选项 --module-path”错误仍然存​​在

在 Intellij 中使用 Maven 和 JavaFX (2019.1)。我一直在关注这个教程。

我有一个不断发生的奇怪错误 - 每次我继续运行插件时javafx:run,它都会失败,并给出以下错误:

Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Unrecognized option: --module-path
Run Code Online (Sandbox Code Playgroud)

但是,当我将可执行文件放入javafx-maven-plugin( <executable>"C:\Program Files\Java\jdk-12.0.1\bin\java.exe"</executable>) 中时,它就可以工作。我在 Windows 上,并已将JAVA_HOME系统环境变量设置为C:\Program Files\Java\jdk-12.0.1安装 JDK 的位置。

这是一个奇怪的问题,虽然并不重要,但很高兴知道答案。

编辑:

pom.xml:

<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 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>uk.co.harveyellis</groupId>
    <artifactId>HelloFX</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>12</maven.compiler.source>
        <maven.compiler.target>12</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>11.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>11.0.2</version>
        </dependency>
    </dependencies> …
Run Code Online (Sandbox Code Playgroud)

java javafx intellij-idea maven module-path

4
推荐指数
2
解决办法
1万
查看次数

标签 统计

intellij-idea ×1

java ×1

javafx ×1

maven ×1

module-path ×1