title: getting error Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
body: <p>this is the error i got </p>
  
  <pre><code>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0  at TrfFiles2Dev.main(TrfFiles2Dev.java:55
  </code></pre>
  
  <p>this is the code I'm working on</p>
  
  <pre><code>public  void send (String fileName) {
      String SFTPHOST = "";
      int SFTPPORT = 22;
      String SFTPUSER = "";
      String SFTPPASS = "";
      String SFTPWORKINGDIR = "";
      Logger log = Logger.getLogger(TrfFiles2Dev.class.getName() );
      Session session = null;
      Channel channel = null;
      ChannelSftp channelSftp = null;
      System.out.println("preparing the host information for sftp.");
      try {
          JSch jsch = new JSch();
          session = jsch.getSession(SFTPUSER, SFTPHOST, SFTPPORT);
          session.setPassword(SFTPPASS);
          java.util.Properties config = new java.util.Properties();
          config.put("StrictHostKeyChecking", "no");
          session.setConfig(config);
          session.connect();
          System.out.println("Host connected.");
          channel = session.openChannel("sftp");
          channel.connect();
          System.out.println("sftp channel opened and connected.");
          channelSftp = (ChannelSftp) channel;
          channelSftp.cd(SFTPWORKINGDIR);
          File f = new File(fileName);
          channelSftp.put(new FileInputStream(f), f.getName());
          log.info("File transfered successfully to host.");
      } catch (Exception ex) {
           System.out.println("Exception found while tranfer the response.");
      }
      finally{
  
          channelSftp.exit();
          System.out.println("sftp Channel exited.");
          channel.disconnect();
          System.out.println("Channel disconnected.");
          session.disconnect();
          System.out.println("Host Session disconnected.");
      }
  }   
  public static void main(String[] args) {
      TrfFiles2Dev trfFiles2Dev = new TrfFiles2Dev();
      trfFiles2Dev.send(args[0]);
  }   }
  </code></pre>
  
  <p>Thank you in advance for any help. I'm not looking to have this done for me, I'm just stuck and need help finding my way.</p>
  
  <p>and how to make this possible to transfer file from my server to other server?</p>