title: How to open email client with attachment from Java
body: <p>Already there are too many questions with this. 
  Possible duplicate:<br>
  1. <a href="https://stackoverflow.com/questions/1564147/how-to-open-an-email-client-and-automatically-attach-file-in-java">How to open an email client and automatically attach file in java</a><br>
  2. <a href="https://stackoverflow.com/questions/6029579/start-mail-client-with-attachment/">Start Mail-Client with Attachment?</a>  </p>
  
  <p>My requirement is:
  1. open default email client from Java.<br>
  2. add 'to' address, Subject and body text from Java.<br>
  3. <strong>Attach a file to the mail</strong></p>
  
  <p>However these two are not working for me...<br>
  <strong>JDIC:</strong><br>
  When I use JDIC I am getting the following error:<br>
  <code>java.lang.ClassNotFoundException: org.jdesktop.jdic.desktop.internal.impl.ServiceManagerStub_unix</code>  </p>
  
  <p><strong>JMAPI:</strong><br>
  When I use JMAPI I am getting following.  </p>
  
  <pre><code>java.lang.UnsatisfiedLinkError: org.jdesktop.jdic.desktop.internal.impl.WinAPIWrapper.RegOpenKey(I[BI)[I
      at org.jdesktop.jdic.desktop.internal.impl.WinAPIWrapper.RegOpenKey(Native Method)
      at org.jdesktop.jdic.desktop.internal.impl.WinAPIWrapper.WinRegQueryValueEx(WinAPIWrapper.java:170)
      at jmapi.JMAPI.isMapiSupported(JMAPI.java:40)
      at com.turborep.turbotracker.mail.SendQuoteMail.send(SendQuoteMail.java:120)
      at com.turborep.turbotracker.mail.SendEmail.main(SendEmail.java:77)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:212)
      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
  </code></pre>
  
  <p>I assume, JMAPI will work only with windows machines (because need to open jdic.dll library).<br>
  My machine is: Ubuntu 12.04 &amp; JDK6  </p>
  
  <p>Is there any other possibility to achieve this in Ubuntu.</p>
  
  <p>Thanks in advance.</p>
  
  <p>**EDIT: ** 
  My machine is running with 64 bit JVM.</p>