JavaFX-11 in VSCode: Error: Could not find or load main class Files\Java\javafx-sdk-11.0.2\lib

As you can see by the error you have posted:

Error: Could not find or load main class Files\Java\javafx-sdk-11.0.2\lib

it is clear that the issue is related to the space you have in Program Files.

Solutions

As a possible solution, you could move your JavaFX SDK to a folder without spaces in its path, and set your vmArgs accordingly, like:

"vmArgs": "--module-path C:\\Java\\javafx-sdk-11.0.2\\lib --add-modules javafx.controls,javafx.fxml",

While that works, if you still want to keep your current approach, you have to find a way to set the path with spaces.

Based on a similar issue, you can find that:

Paths containing spaces should be surrounded by (escaped) double quotes

So this will be the solution in your case:

"vmArgs": "--module-path \"C:\\Program Files\\Java\\javafx-sdk-11.0.2\\lib\" --add-modules javafx.controls,javafx.fxml",

Note this doesn't apply to the path added in the .classpath file with the JavaFX jars, that will be like this:

<classpathentry kind="lib" path="C:\\Program Files\\Java\\javafx-sdk-11.0.2\\lib\\javafx.base.jar"/>