Unrecognized option: –module-path Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred

huangapple go评论68阅读模式
英文:

Unrecognized option: --module-path Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred

问题

我尝试设置环境变量_JAVA_OPTION分配1GB内存。

英文:

trying to setup a JavaFX project for the first time on vscode

error keep showing:

Unrecognized option: --module-path
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
PS C:\Users\bisce\Desktop\coding\JavaProjects\FirstJavaFXProject>

I tried setting up the env variable _JAVA_OPTION to have 1GB of memory allocated.

attaching a screenshot of the launch.json file:
launch.json

Farewell

I tried setting up the env variable _JAVA_OPTION to have 1GB of memory allocated.

答案1

得分: 1

首先,确保你正在使用Java9或更高版本,然后在launch.json中配置[vmArgs]:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "App",
            "request": "launch",
            "mainClass": "application.Main",
            "projectName": "FirstJavaFXProject",
            "vmArgs": "--module-path C:/Java/java-sdk-20.0.1/lib --add-modules javafx.controls,javafx.fxml",
        }
    ]
}

路径周围不要有单引号。

更多信息请参考此文档

Unrecognized option: –module-path Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred

英文:

First you need to make sure you are using Java9 or higher, then configure vmArgs in launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "App",
            "request": "launch",
            "mainClass": "application.Main",
            "projectName": "FirstJavaFXProject",
            "vmArgs": "--module-path C:/Java/java-sdk-20.0.1/lib --add-modules javafx.controls,javafx.fxml",

        }
    ]
}

No single quotes around the path.

It will be more helpful to refer to this document.

Unrecognized option: –module-path Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred

huangapple
  • 本文由 发表于 2023年5月7日 22:14:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/76194460.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定