如何引用classes下Authenticator子类
想用jsp+javamail做一个发送邮件的程序。先定义了一个Authenticator的subclass:
package com.yang.CH17;import javax.mail.*;import java.util.*;public class PopupAuthenticator extends Authenticator { String username, password; public PopupAuthenticator(String username, String password) { this.username = username; this.password = password; } public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); }}<% :Authenticator auth = (Authenticator) new PopupAuthenticator("8888","haha"); :%><%@ page import="classes.Authenticator"%>;
[解决办法]
放在classes下然后再放在和包名一样的文件夹下面
classes/com/yang/CH17
或者做成jar放在bin目录下