Guide on how to get GUI on WSL

  1. Download VcXsrv on your windows computer and run the installer (I recommend to add a desktop icon during installation to easily access the application)
  2. In a file explorer open C:\Program Files\VcXsrv and search for “xlaunch.exe” and open (Alternatively if you set up a desktop icon during installation you can double click on that instead) create a “multiple window display” with “start no client”, and make sure in extra settings to check “Disable access control”, then press next/finish vcxrsv_image_1 vcxrsv_image_2
  3. Open a WSL window and open the ~/.bashrc file in vscode (code ~/.bashrc) or with nano (nano ~/.bashrc), in this file add the following lines
    export DISPLAY=$(ip route list default | awk '{print $3}'):0
    export LIBGL_ALWAYS_INDIRECT=1
    
  4. REOPEN your WSL window, and THEN Run code ~/vscode/[name of apcsa repo] to open a vscode window with your apcsa repo
  5. Run your code, you may need to click the following icon on your taskbar to see the gui java_icon

Note: you may need to run xhost +local: & restart VSCode

  • If you are getting errors about “java.lang.NoClassDefFoundError: Could not initialize class java.awt.GraphicsEnvironment$LocalGE”
  • See more details