java - 如何在 windows-64bit "Home Premium"中设置 javamail 路径和类路径

标签 java jakarta-mail

我已经在 Windows(64 位)上安装了 java。我的问题是:如何在我的 PC 上安装 Javamail?我用这种方式创建类路径 %classpath%;c:\.... 等。但仍然无法正常工作。我得到了错误

The import javax.mail cannot be resolved

最佳答案

要安装 Javamail,您应该查看 ReadMe .其中指出:

Note that the JavaMail API requires the JavaBeans(TM) Activation Framework package to be installed as well if you're using JDK 1.5 or earlier. Download the latest version of the JavaBeans Activation Framework from

http://www.oracle.com/technetwork/java/javase/index-jsp-136939.html

and install it in a suitable location.

  1. Unzip the javamail1_4_5.zip archive. (You may have already done this.)

  2. Set your CLASSPATH to include the "mail.jar" file obtained from the download, as well as the current directory.

    Assuming you unzipped javamail1_4_5.zip in c:\download the following would work:

    set CLASSPATH=%CLASSPATH%;c:\download\javamail-1.4.5\mail.jar;.

    Also, if you're using JDK 1.5 or earlier, include the "activation.jar" file that you obtained from downloading the JavaBeans Activation Framework, in your CLASSPATH.

    set CLASSPATH=%CLASSPATH%;c:\download\activation\activation.jar

  3. Go to the demo directory

  4. Compile any demo using your Java compiler. For example:

    javac msgshow.java

  5. Run the demo. The '-' option lists the required and optional command-line options to successfully run any demo. For example:

    java msgshow -

    lists the available options. And

    java msgshow -T imap -H -U -P -f INBOX 5

    uses the IMAP protocol to display message number 5 from your INBOX.

关于java - 如何在 windows-64bit "Home Premium"中设置 javamail 路径和类路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10161448/

相关文章:

java - 队列大小超过了在 spring boot 中使用的 ThreadPoolTask​​Executor 中配置的最大队列容量

java - 使用构建器方法作为构造函数反序列化外部库类

java - 将按钮添加到 jtable

java - 使用 SMTP 为 SendMail 函数编写单元测试

javamail 邮件图像位于远程计算机上

java - 具有多个内部异常并使用流的异常

Java检查 boolean 值是否已初始化

iMail 的 JavaMail API -- java.net.SocketException : Permission denied: connect

javax.mail - 问题解码主题

Java Mail API setContent() 未作为 HTML 写入邮件正文