0

I have a simple java program with a Dialog Box

String s = (String)JOptionPane.showInputDialog(
                    frame,
                    "Complete the sentence:\n"
                    + "\"Green eggs and...\"",
                    "Customized Dialog",
                    JOptionPane.PLAIN_MESSAGE,
                    icon,
                    possibilities,
                    "ham");

If I launch the program from the Raspbian terminal the Dialog Box appear, but if I connect to the Raspbian with SSH from my macbook and I launch the program from there the Dialog Box doesn't appear. What could be the problem ?

1
  • Is X11Forwarding enabled in the sshd config on the raspberry? Commented Oct 11, 2016 at 13:29

1 Answer 1

1

When you use a ssh you just have a terminal, i.e. it displays characters. You need to use X11. This will allow you to display windows and graphics from a remote computer.

You need:

  • a X11 server on your mac (this may sound a bit confusing, but it provides the service of displaying graphics). X11 used to be part of OS X, but is no longer. It can be installed from here: https://www.xquartz.org/

  • open an X11 terminal and enable X11 access from remote hosts (see man page of xhostcommand. Shortest way is xhost + to allow access from anywhere, but this is very bad security unless you are safely behind a firewall in an environment where you trust all machines)

  • allow x11Forwarding on the ssh server side (see https://unix.stackexchange.com/questions/12755/how-to-forward-x-over-ssh-from-ubuntu-machine )

  • open your ssh connection with x11Forwarding enabled: ssh -X your-server

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.