Farewell to Eclipse, Visual Studio Code for moderately lightweight JavaFX development-Environment construction-

Target audience (current situation of mine)

request

Development environment

--Windows 10 + Visual Studio Code (1.37.0 latest at the time of writing)

Digression

Recently, a Visual Studio Code installer for Java development came out, but I haven't tried it this time (because the Java runtime environment itself was created before this). It seems that the JDK is not OpenJDK but AdoptOpenJDK.

Advance preparation

Download JavaFX from the Official Site. At the time of writing, versions for JDK 12 and LTS for JDK 11 are available. If you have an SDK, you can run it first, so we will introduce the SDK. DL destination is here image.png

Next, expand the DL file to any location. This time, I put the extracted files in C: \ Users \ myuser \ Documents \ jfx \.

Setting method

  1. Add JavaHome to settings.json in Visual Studio Code Please add according to your environment. If you have already built the environment, it may have been added. (IntelliSense itself works even if Java Home is not set, so set from here this time) image.png

  2. Add debug configuration Add the Visual Studio Code debug settings. image.png If you click the bug mark (the icon changes depending on the version) on the sidebar and click the gear mark, launch.json will start in the editor, so add it here.

image.png

I will add it here. image.png


"vmArgs": "--module-path C:\\Users\\myuser\\Documents\\jfx\\javafx-sdk-11.0.2\\lib --add-modules javafx.controls,javafx.fxml"

Add the PATH to the JavaFX lib directory extracted earlier and the module name to be used as shown in.

This makes it possible to check the execution result using debug mode with the F5 key from Visual Studio Code. image.png

Summary

I think this method is useful when it is a little difficult to run Eclipse on the CPU of a laptop computer. However, the Java extension itself is reasonably heavy, so it's a little better than Eclipse, and it's psychologically easier to think about.

Recommended Posts

Farewell to Eclipse, Visual Studio Code for moderately lightweight JavaFX development-Environment construction-
Try to quit Eclipse and switch to Visual Studio Code
Output settings to debug console in Visual Studio Code
Java in Visual Studio Code
[For beginners] Introducing the procedure to Hello, World in C/C ++ language using Visual Studio Code on Ubuntu