title: Download .torrent file Java
body: <p>I am trying to download a .torrent file in Java. I referred to this SO (<a href="https://stackoverflow.com/questions/18672345/java-torrent-file-download">Java .torrent file download</a>) question but when I run the program it does not start the download. It does absolutely nothing. Can someone explain to me what I am doing wrong? I posted an SSCCE below.</p>
  <pre><code>import java.io.File;
  import java.io.FileOutputStream;
  import java.io.IOException;
  import java.net.URL;
  import java.nio.channels.Channels;
  import java.nio.channels.ReadableByteChannel;
  
  public class Test {
      public static void main(String[] args) throws IOException {
          String link = &quot;http://torrage.com/torrent/13764753227BCBE3E8E82C058A7D5CE2BDDF9857.torrent&quot;;
          String path = &quot;/Users/Bob/Documents&quot;;
          URL website = new URL(link);
          ReadableByteChannel rbc = Channels.newChannel(website.openStream());
          File f = new File(path + &quot;t2.torrent&quot;);
          FileOutputStream fos = new FileOutputStream(f);
          fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
          fos.close();
      }
  }
  </code></pre>