title: Download csv file from link with java
body: <p>I'm creating a csv file with data saved to it. The next thing i wanna do is that any person can download that file from a link in a HTML page.</p>
  
  <p>The problem is I've never worked before with Java and I've searched for some good options but non of them seems to work. I hope any one can help me with this.</p>
  
  <p>This is how is save to my CSV file</p>
  
  <pre><code>import java.io.BufferedWriter;
  import java.io.File;
  import java.io.FileWriter;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  public class Logbook {
  
      public Logbook() {
          super();
      }
  
      /**
       * @param date
       * @param memoryMax
       * @param memoryCommitted
       * @param memoryUsed
       * @param JvmUpTimeH
       * @param JvmUpTimeD
       * @param JvmUpTimeM
       * @param JvmUpTimeS
       */
      public void writeLog(String date, Long memoryMax, Long memoryCommitted, Long memoryUsed, String TotalTime) {
  
          File Logbook = new File("C:/Logbook/Logbook.csv");
  
          try (PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(Logbook, true)))) {
              out.println(date + " , " + memoryMax + " b" + " , " + memoryCommitted + " b" + " , " + memoryUsed + " b" + " , " + TotalTime);
          } catch (IOException e) {
              // exception handling left as an exercise for the reader
          }
      }
  
  
      }
  </code></pre>
  
  <p>After this I have a new page were it refreshes the page every sec my code to write it in the file is here</p>
  
  <pre><code>Long memoryUsed=agent.readMemoryUsed();
  Long memoryCommitted=agent.readMemoryCommitted();
  Long memoryMax=agent.readMemoryMax();
  Date today2 = new Date();
  SimpleDateFormat savedLog = new SimpleDateFormat("dd/MM/YY kk:mm:ss");
  String date = savedLog.format(today2);
  
  Logbook logBook = new Logbook();
  logBook.writeLog(date, memoryMax,memoryCommitted,memoryUsed, TotalTime);
  </code></pre>
  
  <p>All I want now is to download the file with that information into it for any person that wanna download it.</p>