我正在创建一个扩展java.net.Authenticator来验证我的FTP代理的类。我得到的错误,当我使用的PasswordAuthentication ...无法解析PasswordAuthentication以键入错误
import java.net.Authenticator;
import java.net.PasswordAuthentication;
class ProxyAuthenticator extends Authenticator {
private String user, password;
public ProxyAuthenticator(String user, String password) {
this.user = user;
this.password = password;
}
//error here
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(user, password.toCharArray());
}
}
我知道前使用这些代码确切行没有任何错误。任何想法有什么不对?
编辑:进口java.net.PasswordAuthentication后,我收到一个错误,指出
java.net.Authenticator.getPasswordAuthentication
“覆盖java.net.Authenticator.getPasswordAuthentication”
谢谢,但现在我得到一个错误说...“覆盖java.net.Authenticator.getPasswordAuthentication” – Acitropy 2013-03-20 17:12:25
这不是整个错误 – ITroubs 2013-03-20 17:13:31
这就是它至少说在Eclipse中。 – Acitropy 2013-03-20 17:17:50