title: How to add an attachment to mailto in Java
body: <p>I am creating a text editor and I would like to add a share feature that would allow you to email your document. I need some help in finding a way to use the mailto with a variable. I use the string "saveName" as the path of the file to be sent. Here is what I have right now: </p>
  
  <pre><code>share.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
  
          Desktop desktop = Desktop.getDesktop();
          String mailData = "mailto:?subject=Document&amp;attachment=" + saveName;
          System.out.println(mailData);
          try {
              desktop.mail(new URI(mailData));
          } catch (IOException e1) {
              e1.printStackTrace();
          } catch (URISyntaxException e1) {
              e1.printStackTrace();
          }
  
          }
      });
  </code></pre>
  
  <p>Can some one shed some light on how to do this? Help is appreciated, thanks.</p>