title: How copy files bigger than 4.3 GB in java
body: <p>I'm writing a program part simply to copy a file from source to a destination File. The code works as well it should but if there is a file large file the process of copy will end up, after the destination file reach a size of 4.3 GB, with an exception. The exception is a "file is to large" it looks like:</p>
  
  <pre><code>java.io.IOException: Die Datei ist zu groß
  at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
  at sun.nio.ch.FileDispatcherImpl.write(FileDispatcherImpl.java:60)
  at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
  at sun.nio.ch.IOUtil.write(IOUtil.java:65)
  at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:211)
  at java.nio.channels.Channels.writeFullyImpl(Channels.java:78)
  at java.nio.channels.Channels.writeFully(Channels.java:101)
  at java.nio.channels.Channels.access$000(Channels.java:61)
  at java.nio.channels.Channels$1.write(Channels.java:174)
  at java.nio.file.Files.copy(Files.java:2909)
  at java.nio.file.Files.copy(Files.java:3069)
  at sample.Controller.copyStream(Controller.java:318)
  </code></pre>
  
  <p>The method to produce that is following:</p>
  
  <pre><code>    private void copyStream(File src, File dest){
      try {
  
          FileInputStream fis = new FileInputStream(src);
          OutputStream newFos = java.nio.file.Files.newOutputStream(dest.toPath(),StandardOpenOption.WRITE);
  
          Files.copy(src.toPath(),newFos);
  
          newFos.flush();
          newFos.close();
          fis.close();
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>I also tried to use java.io Fileoutputstream and write in a kbyte way, but there happends the same. How can I copy or create files larger than 4.3 GB? Is it maybe possible in other language than java? This programm I run on a Linux (Ubuntu LTS 16.04).</p>
  
  <p>Thanks in advance.</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>Thanks very much you all for your help. As you said, the file system was the problem. After i formated the file system to exfat it works fine.</p>