无法使用 mailR 包发送电子邮件 [英] Unable to send email using mailR package

查看:44
本文介绍了无法使用 mailR 包发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了下面提到的错误.我把mail.jar、activation.jar、mailapi.jar、common-lang3.jar复制到/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext

I am getting below mentioned error. I copied mail.jar, activation.jar, mailapi.jar, common-lang3.jar to /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext

java.lang.NoClassDefFoundError: javax/activation/DataHandler
    at org.apache.commons.mail.Email.createMimeMessage(Email.java:1832)
    at org.apache.commons.mail.Email.buildMimeMessage(Email.java:1268)
    at org.apache.commons.mail.Email.send(Email.java:1436)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at RJavaTools.invokeMethod(RJavaTools.java:386)
Caused by: java.lang.ClassNotFoundException
    at RJavaClassLoader.findClass(RJavaClassLoader.java:383)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:566)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
    ... 8 more
NULL
Error: NoClassDefFoundError (Java): javax/activation/DataHandler

推荐答案

Vince Fulco 提供的链接中的评论之一适用于 Ubuntu 18.04:https://github.com/rpremraj/mailR/issues/77#issuecomment-465741847

One of the comments in the link Vince Fulco provided works in Ubuntu 18.04: https://github.com/rpremraj/mailR/issues/77#issuecomment-465741847

特别是:

  1. 下载以下 .jar 文件:

  1. Download the following .jar files:

找出 java-mailR 文件夹:system.file("java", package = "mailR")

Find out the java-mailR folder: system.file("java", package = "mailR")

  • 就我而言:/home/MY_USERNAME/R/x86_64-pc-linux-gnu-library/3.5/mailR/java"

将两个 .jar 文件复制到该文件夹​​中

Copy the two .jar files into that folder

为了以防万一,我在尝试之前重新启动了计算机.

Just in case, I rebooted the computer before trying it.

这篇关于无法使用 mailR 包发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆