vscode java launch.json args

Viewed 15593

I am trying to pass multiple arguments to my test java program in visual studio code:

public class test{

    public static void main(String[] args) {
        String x = args[0] 
        //String x = args[0] + arg[1];
        System.out.println(x);
    }
}

If I use 1 parameter in my launch.json, then it works:

    {
        "type": "java",
        "name": "Debug (Launch)",
        "request": "launch",
        "cwd": "${workspaceFolder}",
        "console": "internalConsole",
        "stopOnEntry": false,
        "mainClass": "",
        "args": "bla"
    }

But if i want to put 2 parameters, then it doesn't work. Tried a few combinations in my launch.json:

"args": ["bla","bla"],
"args": "bla" "bla",
"args": "['bla','bla']"

But then it looks like the debugger is hanging.

Thanks in advance.

1 Answers

You can pass multiple arguments in the same string, space-separated:

"args": "bla bla"
Related