Malady
Malady

Reputation: 263

How do I make VS Code compile my Javas with Javac instead of g++?

How do I make VS Code compile my Javas with Javac instead of g++, while still letting me compile C++ stuff?

I have the JDK and JSK, and there's a Javac.exe inside the JDK...

My Launch.json is:

"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"
    }
]

Oh... It's trying to build with g++ since that's the PreLaunchTask... So I gotta make another configuration for "java"... But I dunno how to do that...

Upvotes: 1

Views: 392

Answers (1)

Elvis Xia - MSFT
Elvis Xia - MSFT

Reputation: 10841

It's trying to build with g++ since that's the PreLaunchTask... So I gotta make another configuration for "java"... But I dunno how to do that

Generally, launch.json is auto generated for you when you run the file or create a new project. You can regenerated it simply by delete launch.json and run again. But if you want to know how to customize launch.json. You can refer to Lauch.json Attributes.

Upvotes: 1

Related Questions