[LINUX] Java with Visual Studio Code (Part 2)

Java with Visual Studio Code (Part 2)

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.

Environment to build

WSL installation

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).

OpenJDK installation

** 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

VS Code installation

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.

Extension installation

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

Setting tasks.json and launch.json will make it more convenient, but please refer to the manual of each plugin for details.

at the end

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.

Recommended Posts

Java with Visual Studio Code (Part 2)
Build Python development environment with Visual Studio Code
Remote debugging with Visual Studio 2017
Preparing to use Tensorflow (Anaconda) with Visual Studio Code
Python development environment with Windows + Anaconda3 + Visual Studio Code
Python development environment with Windows + Python + PipEnv + Visual Studio Code
Set up a Python development environment with Visual Studio Code
Visual Studio Code may be good
Try to create a python environment with Visual Studio Code & WSL
Edit files directly on Linux with Visual Studio Code Remote SSH
Build jupyter notebook environment with Visual Studio Code (VS Code) Mac version
Installation of Visual studio code and installation of python
Use Jupyter Notebook with Visual Studio Code on Windows 10 + Python + Poetry + pyenv-win
I installed the library with Visual Studio Code, but Unable to import
Time when terminal disappears in Visual Studio Code
Django with Python Tools 2.2 for Visual Studio (PTVS 2.2)
Settings for Python coding in Visual Studio Code
[Visual Studio Code] [Python] Tasks.json + problemMatcher settings for Python
I customized it with Visual Studio Code (mainly for python), so I will summarize it
A note I was addicted to when running Python with Visual Studio Code
Strengthen with code test ⑦
Strengthen with code test ⑨
Strengthen with code test ③
Try debugging Python on Raspberry Pi with Visual Studio.
Strengthen with code test ⑤
Strengthen with code test ④
Execute C ++ functions from Python with Pybind11 (for Windows & Visual Studio Code people) Debugging
sandbox with neo4j part 10
Make Visual Studio Code autocomplete for python external libraries
Strengthen with code test ②
Until you run server Django in Visual Studio Code
Japanese output when dealing with python in visual studio
Hamming code with numpy
Strengthen with code test ①
Strengthen with code test ⑧
Strengthen with code test ⑨
Execute C ++ functions from Python with Pybind11 (for Windows & Visual Studio Code people) Environment construction
How to use linux commands in Visual Studio Code terminal
Enable the virtualenv Python virtual environment for Visual Studio Code
What has changed since I started using Visual Studio Code
Do something like a Python interpreter in Visual Studio Code
Install python and Visual Studio Code on windows10 (April 2020 version)
Build Python3 for Windows 10 on ARM with Visual Studio 2019 (x86) on Windows 10 on ARM
Get country code with python
Image processing with Python (Part 2)
Studying Python with freeCodeCamp part1
Install numpy in Visual Studio 2019
Bordering images with python Part 1
Scraping with Selenium + Python Part 1
Part 1 Attempt to code mathematics (∈)
Studying Python with freeCodeCamp part2
Debug Python with VS Code
Image processing with Python (Part 1)
Solving Sudoku with Python (Part 2)
Bottle Pug in Visual studio 2019
Image processing with Python (Part 3)
Python development in Visual Studio 2017
Check the code with flake8
Scraping with Selenium + Python Part 2
[memo] Java FizzBuzz Code Golf
Python development in Visual Studio