Coding in WSL2

Windows 10 added a new feature called windows subsystem for Linux. Suprisingly, it keeps evolving, now in version 2 and supposedly will be even better in windows 11 with easier install and more features. Also my IDE of choice IDEA is supporting it. And as I had a bit of time on my hands in new job as I was waiting on a new Mac to arrive to replace my windows machine, I figured I will give it a try.

As the new code base, run environment and built tools of my new project was not compatible with windows, I had the following idea:

Have the code, java, git and runtime in WSL2 and leave the IDEA in windows. The installation was fine, using the apputility to install everything in a jiffy.

  • Go to windows store :). Search for Ubuntu. Install latest version.
  • Start ubuntu from start menu.
  • Install git, java, install docker in Ubuntu (manually or by using Docker Desktop which sets it up)
sudo apt install git
sudo apt install openjdk-11-jdk
sudo docker pull postgres:11sudo docker run --name postgres11 -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:11

Checked out the code on WSL2 subsystem using the WSL2 git.

Then I went to IDEA and configured it to use git from the WSL. This works surprisingly well and gives you the option to skip git installation on windows which is a weird linux/win hybrid.

Then I opened the project on WSL2 subsystem. Yes it is possible and should work fine … but it does not. My project was maven multi-module and all maven projects were marked with error message:

Connection refused to host: in WSL maven connector

Apparently this is a known bug in IDEA: and as of writing this it should be fixed, but not released. But in my case this was a blocker and it rendered the project unusable.

Plan B was to install IDEA in WSL2 and use its UI through XServer

Install XServer:

Then follow:

I had to install idea from a zip/tar file as apparently snap utility is not supported on wsl. See

The ide ran fine, IDEA ran in WSL, UI was being stream to xserver in windows. But the UI experience was rather poor. Icons had a strange outline, popup windows did not render correctly, some of the popups were not rendered at just displaying some bufferend UI fragment. Otherwise it was usable, project imported correctly), UI speed through xserver was OK. I managed to fix the icons by setting some obscure idea parameter, but not the bad popups.

And then I finally received my Mac and could give up on this. So the outcome is that the WSL IDEA support is not there yet.

WSL on its own is awesome and provides much needed full linux support on windows.