This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes Java mail api Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Java mail api" Watch "Java mail api" New topic

Java mail api

Sree Kumari
Ranch Hand

Joined: Aug 16, 2005
Posts: 47
when i try to compile an javamail application using tomcat5 the error message is as follows.I have set the classpaths also

Unable to compile class for JSP

An error occurred at line: 9 in the jsp file: /MailExample.jsp

Generated servlet error:
[javac] Compiling 1 source file

C:\jakarta-tomcat-5.0.16\work\Catalina\localhost\examples\org\apache\jsp\ package javax.mail does not exist
import javax.mail.*;etc----

The problem seems to be of the classpath.
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

The problem seems to be of the classpath

Correct. The JavaMail jar files need to be in the classpath. In the case of a WebApp that is usually in WEB-INF/lib.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
Apart from what Paul has mentioned in his post, include the pop3.jar, jmail.jar, mailapi.jar and activation.jar in the classpath.


I agree. Here's the link:
subject: Java mail api
Similar Threads
Tomcat and JSP (Interesting problem)
Need help in javax.mail package.......very urgent
Problem with mailing thru JSP
Have problem when I run jsp on server.
mail sending in jsp