如何让VS代码用Javac而不是g+编译Java+;? 我如何让VS代码用Javac代替G++编译Javas,同时仍然允许我编译C++的东西?

如何让VS代码用Javac而不是g+编译Java+;? 我如何让VS代码用Javac代替G++编译Javas,同时仍然允许我编译C++的东西?,java,visual-studio-code,Java,Visual Studio Code,我有JDK和JSK,JDK里面有一个Javac.exe 我的Launch.json是: "version": "0.2.0", "configurations": [ { "name": "g++.exe build and debug active file", "type": "cppdbg", "request": "launch", "program": "${fileDirname}\\${fileBasename

我有JDK和JSK,JDK里面有一个Javac.exe

我的Launch.json是:

"version": "0.2.0",
"configurations": [
    {
        "name": "g++.exe build and debug active file",
        "type": "cppdbg",
        "request": "launch",
        "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ],
        "preLaunchTask": "g++.exe build active file"
    }
]

哦。。。它正在尝试使用g++进行构建,因为这是启动前的任务。。。所以我要为“java”做另一个配置。。。但我不知道怎么做

它正在尝试使用g++进行构建,因为这是启动前的任务。。。所以我要为“java”做另一个配置。。。但我不知道该怎么做


通常,在运行文件或创建新项目时,会自动生成launch.json。您只需删除launch.json并重新运行即可重新生成它。但是如果您想知道如何定制launch.json。您可以参考。

文档可能有帮助: