IntelliJ IDEA 2022.2 Help

GUI forwarding

If you develop a web application or some other project that contains Graphical User Interface (GUI) remotely, you can forward GUI from a remote server to JetBrains Client using Xpra or VNC viewer.

Xpra configuration

When you work with Xpra, keep its pros and cons in mind:

  • It handles each window by itself and displays it as a native window on your local machine.

  • It handles HiDPI better than VNC.

  • It sets up the whole environment by itself, only a single command needs to be started.

  • It allows you to forward different items and devices such as clipboard, sound, cameras, and so on.

  • It allows you to forward a real desktop.

  • It can work as a server also on Windows and macOS.

  • It is quite heavy because ships a lot of additional items.

  • In some distributions such as Ubuntu, Xpra has quite an old version (3.1.3) while the version 4.3.4 is the latest

Configure Xpra for a remote project

  1. Connect to your remote server and enter the following command:

    sudo apt-get install xpra x11vnc xvfb

    Note that the package name might be different in the distributions other than Ubuntu or Debian.

  2. On you local machine, install the Xpra application.

  3. Open the remote project using JetBrains Gateway.

  4. Open the embedded terminal and execute the following command:

    xpra start --bind-tcp=0.0.0.0:10000 --use-display=no --daemon=no :10
  5. Click forward at the terminal suggestion to forward an opened port 10000.

    Forward port
  6. On your local machine, in the local terminal, execute the following command:

    xpra attach tcp://localhost:10000

    The port number is taken from the forwarded to label in the terminal tool window.

  7. In JetBrains Client, from the main menu, select Edit Configurations to open the desired run configuration with your GUI application.

  8. In the Run/Debug Configurations dialog, in the Environment Variables field, add DISPLAY=:10 and click OK to save the changes.

    Run/Debug Configuration
  9. On the main menu, click Run next to your configuration.

    The application window forwarder by Xpra gets displayed.

    Xpra viewer

VNC configuration

When you work with VNC, keep the following pros and cons in mind:

  • Xvfb and x11vnc are standard Linux tools.

  • VNC is lighter comparing to Xpra.

  • As a prerequisite, a window manager such as fluxbox has to be installed on a remote server.

  • The windows aren't rendered natively on your machine.

  • It is not displayed properly on the HiDPI screens.

Configure VNC for a remote project

  1. Connect to your remote server and enter the following command:

    sudo apt-get install x11vnc xvfb fluxbox

    Note that the package name might be different in the distributions other than Ubuntu or Debian.

  2. On your local machine, install a VNC client, such as tigervnc or any alternative VNC client.

  3. Open the remote project using JetBrains Gateway.

  4. Open the embedded terminal and execute the following command:

    Xvfb :10 -screen 0 1920x1080x24 & DISPLAY=:10 fluxbox & x11vnc -display :10 -autoport 10000 -localhost -scale 1.75
  5. Click forward at the terminal suggestion to forward an opened port 10000.

    Forward port
  6. On your local machine, in the local terminal, execute the following command:

    vncviewer localhost:10000

    The port number is taken from the forwarded to label in the terminal tool window.

    An empty VNC session gets started.

  7. In JetBrains Client, from the main menu, select Edit Configurations to open the desired run configuration with your GUI application.

  8. In the Run/Debug Configurations dialog, in the Environment Variables field, add DISPLAY=:10 and click OK to save the changes.

    Run configuration
  9. On the main menu, click Run next to your configuration.

    You should see your application inside the VNC viewer. In the case of HiDPI, your application may look blurry.

    Application inside the VNC viewer
Last modified: 29 November 2022