我无法使用同步HashMap,因为它看起来像james apache服务器2.3.1不允许这样。编译apache james服务器时无法使用HashMap 2.3.1
这是错误消息我得到:
error: generics are not supported in -source 1.4
Map<String, String> list = new HashMap<String, String>();
^
(use -source 5 or higher to enable generics)
1 error
1 warning
这是我在我的代码中使用其中的一个较短的版本。我基本上只是将一些SQL结果存储到这个列表中。
try {
conn = ......);
String SQL = "SELECT * FROM list";
getListRS = conn.prepareStatement(SQL);
ResultSet rsListResult = getListRS.executeQuery();
Map<String, String> list = new HashMap<String, String>();
while (rsListResult.next()) {
list.put(rsListResult.getString(0), rsListResult.getString(1));
}
rsListResult.close();
conn.close();
}
catch (SQLException se) {
se.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
finally {
try {
if (getListResult != null) {
getListResult.close();
}
}
catch (SQLException se2) {
se2.printStackTrace();
}
try {
if (conn != null) {
conn.close();
}
}
catch (SQLException se) {
se.printStackTrace();
}
}
if (this.list.containsKey(mail.getSender()+"="+mail.getRecipients())) {
System.out.println(list);
return mail.getRecipients();
} else {
System.out.println(listlist);
return null;
}
由于James不让我编译,还可以使用其他什么清单来达到这个目的。
的错误是在这里:
<javac destdir="${build.classes}" debug="${debug}" optimize="${optimize}" deprecation="${deprecation}" target="${jdk.target}" source="${jdk.source}">
是你得到的唯一错误信息是? – Arctigor
这是java编译器的错误,你用什么来编译你的类? maven,蚂蚁? –
Yeap,这是唯一的错误消息。我无法编译。那么是否有类似于hashmap的东西,我可以用它来编译,因为我不知道如何更高的源代码。据我所知,这个服务器是非常古老的,我不认为它支持更进一步的Java,因为我专门为它安装了1.4 jdk – Nicky