enter image description herefollowing image showing the error while running the JAVA GUI application.I use the following command to run the jar file by adding class path of the pi4j lib.

  • cannot see the image or the command used.
    – rob
    Commented Mar 10, 2015 at 11:17
  • If you are programming GUI in Java, you might want to read about JavaFX. Everything I see says that JavaFX is the successor to Swing.
    – Kolban
    Commented Apr 3, 2015 at 14:01

1 Answer 1


This depends on what you want to do. It seems that the java program does not get access to a running X11 server. Do you run X11 on your pi? If so, then physically connecting keyboard, mouse and screen to it would probably solve your problem.

If you want the program running on the pi to use the X11-server of the machine you are running ssh from, then simply add the option -X to your ssh command, like so:

ssh -X pi@raspberrypi

and the pi will display the UI on your local machine.

  • Although that screenshot is in a GUI terminal, it could be an ssh session -- something the OP left ambiguous. So good point.
    – goldilocks
    Commented Mar 10, 2015 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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