Reputation: 2043
Already there are too many questions with this.
Possible duplicate:
1. How to open an email client and automatically attach file in java
2. Start Mail-Client with Attachment?
My requirement is:
1. open default email client from Java.
2. add 'to' address, Subject and body text from Java.
3. Attach a file to the mail
However these two are not working for me...
JDIC:
When I use JDIC I am getting the following error:
java.lang.ClassNotFoundException: org.jdesktop.jdic.desktop.internal.impl.ServiceManagerStub_unix
JMAPI:
When I use JMAPI I am getting following.
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)
I assume, JMAPI will work only with windows machines (because need to open jdic.dll library).
My machine is: Ubuntu 12.04 & JDK6
Is there any other possibility to achieve this in Ubuntu.
Thanks in advance.
**EDIT: ** My machine is running with 64 bit JVM.
Upvotes: 0
Views: 2752
Reputation: 24202
you (or some library you include) are using the JDesktop Integration Components (JDIC) project, which has a version per target operating system and requires native libraries (which it uses via JNI).
your 1st error
java.lang.ClassNotFoundException: org.jdesktop.jdic.desktop.internal.impl.ServiceManagerStub_unix
is probably caused by deplying the windows (or any non-unix) version of the library on a unix machine.
while your 2nd error
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)
means that either youre not including the requires dll properly or that you're running on a 64-bit JVM using a 32-bit dll - see more info here (this is someone with your exact issue)
Upvotes: 2