Since support for Windows 7 has finally ended, I decided to build a development environment so far on Windows 10. By the way, I remember writing this article over a year ago, so let's change the Java development environment to VS Code instead of eclipse or Intellj. I thought, I decided to summarize the process up to building on Ubuntu of Windows Subsystem for Linux (WSL) in an article. In Previous article, I summarized how to build an environment on Ubuntu, so this time I will mainly focus on the cooperation between WSL and VS Code.
If you're a regular Linux or Mac OS user, it's normal to use WSL on Windows 10, right? Enable WSL according to Official Procedure and install Ubuntu (18.04).
** Install OpenJDK on Ubuntu ** instead of Windows. I used ver11 this time, but please use your favorite version. You can install it with apt from the WSL terminal.
$ sudo apt update $ sudo apt install -y openjdk-11-jdk
Install ** Windows version of VS Code ** instead of Ubuntu version from Official site.
A reboot is required in the PATH setting so that it can be started with the
code command, so restart Windows after installation.
If you install the Ubuntu version of VS Code on Ubuntu of WSL, you can't use it without displaying X-Window, so I won't use that method this time.
Remote Development A plug-in that allows you to safely edit files remotely from the Windows side to the WSL side. If you develop only with WSL, you can use only "Remote WSL", but if you install "Remote Development", "Remote WSL" will also be installed, and it seems that you can remote not only WSL but also the environment where SSH connection is possible and the Docker container (trial) Not). An extension that wasn't available at at the time of writing this article, but was released around last summer. Thanks to that, I think there is nothing that VS Code can't do anymore. An image similar to the tramp function of Emacs? .. It would be even more convenient if sshfs could be used with WSL ...
As a procedure, after installing "Remote Development", exit VS Code once and execute the
code command from Ubuntu of WSL to use it. (It takes time to start the first time)
Take a sample project created with gradle as an example (see Previous article for details)
$ mkdir sample $ cd sample $ gradle init --type java-application $ code . Installing VS Code Server for ...← When this is displayed, wait until it starts
If the permission settings of Windows Firewall are displayed, allow it. This will open a Windows version of VS Code window where you can develop Java projects created on WSL.
Java Extension Pack Install as in Previous article. Please note that it will not be enabled unless you click "install on WSL" during installation and install it on the WSL side.
You can also search for and install other plugins such as git and gralde as needed.
The VS Code terminal should also be a WSL shell.
You can check the operation by executing any command from the terminal area of VS Code with
ctrl + shift + ``.
$ gralde run
launch.json will make it more convenient, but please refer to the manual of each plugin for details.
It seems that VS2019 can be developed remotely to WSL or SSH server instead of VSCode.
A long time ago, I didn't feel like using Windows except in situations where I could only develop in Microsoft languages such as DLLs and .Net, but these days it's not at all. It's a great progress. It seems that "Windows Terminal" will be released soon (April 2020?), So I don't feel that the ease of development will increase.