JavaMail Problem. Help !

larva

Member
Jul 15, 2001
185
0
0
Hi folks,

I am trying to use JavaMail API 1.2 to create an email program. I have st my classpath to the following :

E:\j2sdk1.4.0\lib\tools.jar;E:\javamail-1_2\mail.jar;E:\jaf-1.0.1\activation.jar;E:\j2sdkee1.3.1\j2ee.jar

and I typed in the following code

import javax.mail.*;
import javax.swing.*;
import java.util.*;

public class PopupAuthenticator extends Authenticator
{
public PasswordAuthentication getPasswordAuthentication()
{
String username, password;
String result = JOptionPane.showInputDialog("Enter 'username,password'");
StringTokenizer st = new StringTokenizer(result, ",");
username = st.nextToken();
password = st.nextToken();
return new PasswordAuthentication(username, password);
}
}

when I compiled it using javac command, error message display as follows:

1) package javax.mail doesn't exist
2) Cannot resolve symbol Authenticator

Please help ! Thank you !

regards,
Larva
 

manly

Lifer
Jan 25, 2000
13,331
4,100
136
Well obviously the compiler can't find the JavaMail classes.

Double-check your CLASSPATH.
 

larva

Member
Jul 15, 2001
185
0
0
Hi manly,

I think I have set the classpath correctly as shown on my first posting above. Why can't the system still can't detect it ? Thanks for your feedback ?

regards,
Larva
 

manly

Lifer
Jan 25, 2000
13,331
4,100
136
larva,

First off, to keep things simple, I believe your classpath can be trimmed down to just j2ee.jar (which already includes the JavaMail library).

My guess is you didn't set the classpath correctly. I just did a quick test on my system, and your class compiles:

> export CLASSPATH=/usr/local/together-6.0/bundled/j2ee/lib/j2ee.jar
> javac PopupAuthenticator.java

Note I'm on a Linux box, but it works the same under Windows (the syntax for classpath is slightly different). Note your classpath value looks correct; but javac is telling us that it isn't set correctly.