0

Is it possible to run a java UI (AWT/Swing) application on a Raspberry Pi 2 running OSMC.

I don't know if OSMC runs on top of an X11 layer, or is compatible with the Java UI (AWT/Swing).

1

The short answer is yes, but it requires installing some packages, and have an X-Windows Server running.

These are the instructions for running an X-Windows server on Windows.

Assuming you already have Putty installed, open an SSH connection to your Raspberry Pi running OSMC via Putty (user: osmc pass: osmc [unless you changed it]), then execute the following commands:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install openssl
sudo apt-get install xterm
sudo apt-get install xauth
sudo apt-get install libxtst6
sudo reboot

This will close the putty session. Right click on the top left of the putty window, and choose New Session. Enter the IP address for your Raspberry Pi, then on the left hand side of the PuTTY Configuration window, expand Connection, then SSH, then single click on X11, then check the "Enable X11 forwarding" box. Single click the Session option on the left, then enter a name for this session then save it, but don't open it yet.


For an X-Windows Server I used Xming

On the Windows machine you'll need to install:

  1. Xming
  2. Xming-fonts

All of these can be downloaded from the Xming website.

Once you have Xming installed (don't select the "Open Xming" option during the last step of the install process), you'll need to create a launch configuration. This is done with the application: Xlaunch.exe, which is a wizard that will walk you through the creation of a configuration file.

I chose:

  • "Multiple windows", Next
  • "Start no client", Next
  • Make no changes, Next
  • Save configuration to the same folder where xming is installed.
  • Finish

To start the X-windows server, just double-click on on the file you just saved, config.xlaunch

If you receive errors about an x-server already running (if you choose the start option during install), you may need to start task-manager and close all the X-Server processes.

Now back in the PuTTY client, load the configuration you saved earlier, then connect to your Raspberry Pi. Once connected execute:

xterm

This should open an X-Window on your Windows desktop, which is actually the GUI for the terminal application that is actually being executed on your Raspberry Pi.

This should also work for any java applications that require a GUI.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.