Hi,

I am trying to run matlab from my server which is a linux machine. The
client machine is Mac. The code i am using is the example code in jsch
examples "X11 Forwarding". But this is not working for me. Even if i try to
run firefox it says
----------------------------------------------------------------------------------------------------------
The application 'firefox' lost its connection to the display localhost:30.0;
most likely the X server was shut down or you killed/destroyed
the application
----------------------------------------------------------------------------------------------------------

If i try through terminal all this works fine:
----------------------------------------------------------------------------------------------------------
ssh -X usern...@server
firefox
----------------------------------------------------------------------------------------------------------

Could some one help me on what i am doing wrong or where i am wrong?

The code is:
---------------------------------------------------------------------------------------------------------------------------------------------------------------
    String xhost="127.0.0.1";
    int xport=0;

    try{
      JSch jsch=new JSch();

      String host=null;
      if(arg.length>0){
        host=arg[0];
      }
      else{
        host=JOptionPane.showInputDialog("Enter usern...@hostname",
                                         System.getProperty("user.name")+
                                         "@localhost");
      }
      String user=host.substring(0, host.indexOf('@'));
      host=host.substring(host.indexOf('@')+1);

      Session session=jsch.getSession(user, host, 22);

      String display=JOptionPane.showInputDialog("Please enter display
name",
                         xhost+":"+xport);
      xhost=display.substring(0, display.indexOf(':'));
      xport=Integer.parseInt(display.substring(display.indexOf(':')+1));

      session.setX11Host(xhost);
      session.setX11Port(xport);

      // username and password will be given via UserInfo interface.
      UserInfo ui=new MyUserInfo();
      session.setUserInfo(ui);
      session.connect();

      Channel channel=session.openChannel("shell");

      channel.setXForwarding(true);

      channel.setInputStream(System.in);
      channel.setOutputStream(System.out);

      channel.connect();

---------------------------------------------------------------------------------------------------------------------------------------------------------------

-- 

Computer Scientist
CSDMS, INSTAAR, Univ. of Colorado
P.O.Box 545
Boulder, CO, 80309, USA
Ph:+1-303-492-6462; Fax: +1-303-492-6388
http://csdms.colorado.edu
------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to