简体   繁体   English

为什么此Java Mail调用在JDK 1.5中失败,但在1.6中成功?

[英]Why does this Java Mail call fail in JDK 1.5, but succeed in 1.6?

When I run the following code with JDK 1.5, the last line fails, but when I run it with JDK 1.6 it succeeds. 当我使用JDK 1.5运行以下代码时,最后一行失败,但是当我使用JDK 1.6运行它时,它成功了。 Why is this? 为什么是这样?

Code: 码:

Session session;
session = Session.getDefaultInstance(properties,
new javax.mail.Authenticator() {
    protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication(username, password);
    }
});

// Create a default MimeMessage object.
MimeMessage message = new MimeMessage(session);

通过询问有关缺少激活JAR的评论来得出结论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么iOS 5无法连接到运行JDK 1.6的服务器,而不能连接到JDK 1.5 - Why does iOS 5 fail to connect to a server running JDK 1.6, but not JDK 1.5 java xml验证JDK 1.5与JDK 1.6的区别 - java xml validation JDK 1.5 JDK 1.6 difference JDK 1.6与JDK 1.5兼容吗? - JDK 1.6 compatible with JDK 1.5? 为什么HttpURLConnection在Android上失败但在Java Eclipse中成功? - Why does HttpURLConnection fail on android but succeed in java Eclipse? 为什么列表的通用演员表 <? extends Set..> 列表 <Set..> 在Sun JDK 6上取得成功但在Oracle JDK 7上无法编译? - Why does a generic cast of a List<? extends Set..> to List<Set..> succeed on Sun JDK 6 but fail to compile on Oracle JDK 7? JDK 1.6 与 IBM 1.5 上的 java.security.Keystore 别名 - java.security.Keystore aliases on JDK 1.6 vs IBM 1.5 是否可以使用JDK 1.6构建java代码以在JRE 1.5上运行? - Is is possible to build java code using JDK 1.6 to run on JRE 1.5? ant 和 jdk 1.6 但用 1.5 编译 - ant and jdk 1.6 but compile with 1.5 在jdk 1.5中序列化对象并将其反序列化为jdk 1.6 - Serializing the object in jdk 1.5 and deserializing it jdk 1.6 JDK 1.6编译代码调用JDK 1.5编译代码。 我们会看到什么错误? - JDK 1.6 compiled code call a JDK 1.5 compiled code. what errors will we see?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM