Skip to content

Latest commit

 

History

History
58 lines (31 loc) · 2.96 KB

GuiForWSL.md

File metadata and controls

58 lines (31 loc) · 2.96 KB

Use Java FX with GUI in WSL using X11 Desktop

By default Windows Subsystem for Linux doesn't allow to run graphical interface, we have to install a compatible Windows XServer and enable some ports on Windows Defender.

VcXsrv

1st step is installing VcXsrv on the Windows machine using default settings.

Edit .bashrc file

Using you favorite editor, opne ~/.bashrc, and add at the bottom the following lines:

#installing X11 for WSL export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0 exportLIBGL_ALWAYS_INDIRECT=1
DISPLAY=:0.0 export DISPLAY

First Start

Windows defender pop up will appear, asking to allow acces of the computer's network. Click "Allow Acces" after checking the box "Only local networks"

Settings

It's mandatory that VcXsrv is started before opening the WSL terminal to avoid graphic issues and bug.

Display Settings

In the first selection if you choose " Multiple Windows" the game will start in fullscreen without any button to exit the game, until it is finished. If you choose "One Large Window", at the end of VcXsrv'setup will appear a black window with borders in wich will appear the game when it will start. Leave the default value in "Display number". enter image description here

Then choose the following settings:

enter image description here enter image description here

An icon will appear in the TaskBar. It means that everything is working correctly.

Windows defender Settings

Even if VcXsrv starts correctly, we must enable its Inbound Rules in Windows Defender. You need to open Windows Defender Firewall -> Advanced Settings -> Inbound Rules and check if all Rules named VcXsrv windows xserver are active.

enter image description here After that everything is ready to play without any problem Santorini.

Useful links

Thread with possible solutions to some configuration problems

StackOverlow page with advanced settings in WSL bashrc file for X11

We started here Thanks to: Michael Hirsch, Ph.D.