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.
To create a launch.json file, click the create a launch.json file link in the Run start view. If you go back to the File Explorer view (Ctrl+Shift+E), you'll see that VS Code has created a .vscode folder and added the launch.json file to your workspace.
The launch. json file is located in a . vscode folder in your workspace (project root folder).
A launch. json file is used to configure the debugger in Visual Studio Code. Visual Studio Code generates a launch.
You can pass multiple arguments in the same string, space-separated:
"args": "bla bla"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With