I am new to Java development, I really want to understand the platform and as close as I can to the environment apps would actually run, that means Linux, Docker, Kubernetes, etc.
At the beginning I started by installing the IDE of my choice that is IntelliJ Idea, because I am such a big fan of Resharper I didn’t even think about any other IDE; I created a Linux VM and started there, and while it works fine, I found myself having the same network issues that I get every time I try VMs. I really think HyperV is not really an evolved platform to run VMs. That’s a shame.
So I turned to WSL2! The Windows Subsystem for linux is amazing! but I can’t run UI applications there… or can I?
Well, after talking to friends and reading a bunch of blog posts, I figured it is not that difficult to run linux GUI apps in windows! there are the steps to install IntelliJ Idea in WSL Ubuntu 18.
-
Make sure you have the right version of windows to run WSL, which is Windows 10 Version 1607 (Anniversary Update) you can run
> winver
in a console to verify that ( will use > for commands that need to be run in PowerShell or windows Cmd) -
Look at this article to install and configure WSL2 and download and install Ubuntu 18.04 LTS.
-
In your windows, install an X Server.
I installed
VcXsrv
because it was really simple using chocolatey:> choco install VcXsrv
-
In your Windows machine, create a shortcut, and put this in the properties’ target :
"C:\Program Files\VcXsrv\vcxsrv.exe" :0 -ac -terminate -lesspointer -multiwindow -clipboard -wgl -dpi auto
This will tell the X Server the configurations it needs to allow connections from the WSL instance.
-
In your WSL instance create an environment variable pointing to your host’s (the windows box) IP: (I will use $ as the prompt when a command needs to be run on bash.)
$ export DISPLAY=<your IP>:0
- this part I don’t like: I would love not to depend on the host’s IP, as it might change when you connect using different interfaces or DHCP servers
-
If all is good, running
$ xeyes
will display this:
-
Install the latest JRE in WSL:
$ sudo apt update $ sudo apt upgrade $ sudo apt install default-jre
-
Use
wget
to download and extract the Intellij idea. This is the link for the enterprise edition 2020 3rd quarter:$ wget https://download.jetbrains.com/idea/ideaIU-2020.2.3.tar.gz $ tar -zxf ideaIU-2020.2.3.tar.gz
-
Change to the directory where the Idea running script is and run the idea launcher :
$ cd idea-IU-202.7660.26/bin $ ./idea.sh
-
The UI should be up and running!