title: How to copy a file from Linux System to Windows system using Java program?
body: <p>How to copy a file from Linux System to Windows system using Java program?
  Thanks for your help.
  I want to copy file from linux : /inet/apps/test.java to windows  System1: C:\apps\test
  We can use following program to copy</p>
  
  <pre><code>    public static void copyFiles(String fromFile, String toFile ){
       FileInputStream from = null;
          FileOutputStream to = null;
          try {
            from = new FileInputStream(fromFile);
            to = new FileOutputStream(toFile);
            byte[] buffer = new byte[4096];
            int bytesRead;
  
            while ((bytesRead = from.read(buffer)) != -1)
              to.write(buffer, 0, bytesRead); // write
          }catch(Exception e){e.printStackTrace();}
          finally {
            if (from != null)
              try { from.close();} catch (IOException e) {}
            if (to != null)try {to.close();} catch (IOException e) {}
          }     
   }
  </code></pre>
  
  <p>This program is running on linux.
  so <code>fromFile = /inet/apps/test</code>. What will be the <code>toFile</code> path. If i use simply <code>C:\apps\test</code> then how applicaiton recognise the target as <code>System1</code>.</p>