• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

JavaMail Problem. Help !

larva

Member
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
 
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
 
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.
 
Back
Top