当前位置: 首页 > 知识库问答 >
问题:

VSCode中的Java VMOptions

蒙峰
2023-03-14

我尝试运行一个简单的JavaFX,如下所示;

@Override
public void start(Stage stage) throws Exception {
    Group root = new Group();
    Scene scene = new Scene(root, Color.WHEAT);

    stage.setTitle("Testing");
    stage.setWidth(400);
    stage.setHeight(400);

    stage.setScene(scene);

    stage.show();
}

}

我的VMOptions(存储在缺省的launch.json文件中)如下;

    {
        "type": "java",
        "name": "Launch Main",
        "request": "launch",
        "vmArgs": "--module-path C:/Program Files/Java/javafx-sdk-17.0.1/lib --add-modules=javafx.controls,javafx.fxml",
        "mainClass": "Main",
        "projectName": "Dump_661a224e"
    }

共有1个答案

苏华藏
2023-03-14

将JavaFX SDK放在路径中没有空格的位置,并相应地更新选项以指向新位置。

当前运行时配置将路径中的空格视为参数分隔符。

您也可以通过适当地引用带有空格的路径来解决这个问题。要在json中放置带引号的字符串,需要转义引号。

 类似资料:
  • 例如,关键字“进口”没有颜色。

  • Visual Studio Code - Open Source ("Code - OSS") The Repository This repository ("Code - OSS") is where we (Microsoft) develop the Visual Studio Code product together with the community. Not only do we

  • 我正在使用vscode和Angular,我无法设置触发的断点。所有断点都设置为未绑定断点。 我的环境: 版本:1.64.2(用户设置)日期:2022-02-09T22:02:28.252Z电子:13.5.2Chromium:91.0.4472.164Node.js:14.16.0 V8: 9.1.269.39-电子.0 OS:Windows_NTx64 10.0.22000 我的发射。json }

  • 我在Github上提取了一个克隆的项目,并获得了一个文件,其中包含一个空的

  • ES6 创建 tsconfig.json tsc --init { "compilerOptions": { "module": "commonjs", /* 用来指定要使用的模块标准: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "target": "es6" /* targe

  • Visual Studio Code 扩展 Beautify:Beautify code in place for VS Code ESLint:Integrates ESLint into VS Code Material Theme:Maybe the best theme on VS Code vscode-icons:Icons for Visual Studio Code Emmet: