How to use global arguments for Java in vscode?



I am trying to setup my JavaFX enviroment so I referenced the corresponding Jars. In order to run the code I need to use some VM Arguments
(“vmArgs”: ” –module-path /Users/adrif/Downloads/javafx-sdk-14.0.2.1/lib –add-modules javafx.controls,javafx.fxml”)
in the launch.json. I am working in a multi-project folder so every time a make a new one I have to go to the launch.json and add the arguments. How do I set global arguments? I found adding arguments in “launch” at user settings.json (Launch – Global debug launch configuration. Should be used as an alternative to ‘launch.json’ that is shared across workspaces)
but doesn’t work as I expected.

javafx

As you can see, I have two JavaFX projects under the package JavaFX.

tree

And every time I run a new project I have to add the vmArg line to each project.

launch

This is the “launch” options but as I said, it doesn’t work or there’s someting wrong with how I’m trying to do it. So as the title sais, how to I set global arguments?

Edit : I found the “java.jdt.ls.vmargs” option which allows to specify extre VM Arguments. I does not work either.
enter image description here

Answer

“vmArgs” was JVM related, “java.jdt.ls.vmargs” was java language server related, the language server was contained in the “Language Support for Java(TM) by Red Hat” extension, so it will not work.

The “launch” configuration in settings.json I tried in local and does not work too.

VSCode has not provided this feature for the present, You need to configure the “vmArgs” for each project. This is because the launch.json file contains different language debugging settings, and lots of configuration was exclusive to some language.



Source: stackoverflow