title: NetBeans, how to set DISPLAY environment for remote SSH server (Pi)
body: <p>I have setup my Pi for SSH remote host development using NetBeans.</p>
  
  <p>I can confirm: in </p>
  
  <pre><code>/etc/ssh/sshd_config X11Forwarding yes
  X11DisplayOffset 10...
  </code></pre>
  
  <p>In addition, xauth is installed on the remote Pi.</p>
  
  <p>I have installed XQuartz on my client mac. Upon ssh -X pi@IPaddress, xquartz opens and if i echo $DISPLAY on the remote Pi i get localhost:12.0 ... the number changes with each terminal.</p>
  
  <p>Currently, if have incorrectly set the project environment in netbeans with:</p>
  
  <p>DISPLAY=localhost:11.0 (this is wrong because the number changes with each ssh connection to the remote Pi).</p>
  
  <p>So when i try to run the program, NetBeans will hang and i cant debug either.</p>
  
  <p>My question is, how do i set the DISPLAY Environment correctly for NetBeans so that each time it makes an SSH connection to the remote Pi and requests X11 forwarding, it will have the correct $DISPLAY?</p>
  
  <p>If I run the program from an SSH -X terminal session to my Pi the program executes.</p>
  
  <p>Thanks in advance.</p>