package javax.mail does not exist (Still having trouble)

Good Morning

I know that there are several posts regarding issues with javamail. I have viewed them for the past hour. While several of them address my issue I have been unable to locate a solution.

Bare with me please, I am making this post very thorough. The other threads I have read are frusterating because the problems people tend to post are not clear.

I am trying to run "msgsend" which is a provided demo of javamail-1.4 using command prompt (start - run - cmd) with the javac command.

The output below is directly pasted from command prompt and written in bold.

C:\download\javamail-1.4\demo>javac msgsend.java

C:\download\javamail-1.4\demo>javac msgsend.java

msgsend.java:44: package javax.mail does not exist

import javax.mail.*;

^

msgsend.java:45: package javax.mail.internet does not exist

import javax.mail.internet.*;

^

msgsend.java:140: cannot find symbol

symbol : class Session

location: class msgsend

Session session = Session.getInstance(props, null);

^

msgsend.java:140: cannot find symbol

symbol : variable Session

location: class msgsend

Session session = Session.getInstance(props, null);

^

msgsend.java:145: cannot find symbol

symbol : class Message

location: class msgsend

Message msg = new MimeMessage(session);

^

msgsend.java:145: cannot find symbol

symbol : class MimeMessage

location: class msgsend

Message msg = new MimeMessage(session);

^

msgsend.java:147: cannot find symbol

symbol : class InternetAddress

location: class msgsend

msg.setFrom(new InternetAddress(from));

^

msgsend.java:151: package Message does not exist

msg.setRecipients(Message.RecipientType.TO,

^

msgsend.java:152: cannot find symbol

symbol : variable InternetAddress

location: class msgsend

InternetAddress.parse(to,

^

msgsend.java:154: package Message does not exist

msg.setRecipients(Message.RecipientType.CC,

^

msgsend.java:155: cannot find symbol

symbol : variable InternetAddress

location: class msgsend

InternetAddress.parse(cc,

^

msgsend.java:157: package Message does not exist

msg.setRecipients(Message.RecipientType.BCC,

^

msgsend.java:158: cannot find symbol

symbol : variable InternetAddress

location: class msgsend

InternetAddress.parse(bcc,

^

msgsend.java:167: cannot find symbol

symbol : class MimeBodyPart

location: class msgsend

MimeBodyPart mbp1 = new MimeBodyPart();

^

msgsend.java:167: cannot find symbol

symbol : class MimeBodyPart

location: class msgsend

MimeBodyPart mbp1 = new MimeBodyPart();

^

msgsend.java:169: cannot find symbol

symbol : class MimeBodyPart

location: class msgsend

MimeBodyPart mbp2 = new MimeBodyPart();

^

msgsend.java:169: cannot find symbol

symbol : class MimeBodyPart

location: class msgsend

MimeBodyPart mbp2 = new MimeBodyPart();

^

msgsend.java:171: cannot find symbol

symbol : class MimeMultipart

location: class msgsend

MimeMultipart mp = new MimeMultipart();

^

msgsend.java:171: cannot find symbol

symbol : class MimeMultipart

location: class msgsend

MimeMultipart mp = new MimeMultipart();

^

msgsend.java:185: cannot find symbol

symbol : variable Transport

location: class msgsend

Transport.send(msg);

^

msgsend.java:193: cannot find symbol

symbol : class Store

location: class msgsend

Store store = null;

^

msgsend.java:195: cannot find symbol

symbol : class URLName

location: class msgsend

URLName urln = new URLName(url);

^

msgsend.java:195: cannot find symbol

symbol : class URLName

location: class msgsend

URLName urln = new URLName(url);

^

msgsend.java:212: cannot find symbol

symbol : class Folder

location: class msgsend

Folder folder = store.getFolder(record);

^

msgsend.java:218: cannot find symbol

symbol : variable Folder

location: class msgsend

folder.create(Folder.HOLDS_MESSAGES);

^

msgsend.java:220: cannot find symbol

symbol : class Message

location: class msgsend

Message[] msgs = new Message[1];

^

msgsend.java:220: cannot find symbol

symbol : class Message

location: class msgsend

Message[] msgs = new Message[1];

27 errors

Here are the methods I have tried...

1. Make sure you have most current version of Java

2. Reinstall Java

3. Attempt to compile in an IDE (Attempted in Eclipse 3.2)

4. Set class path

Some sources suggest "CLASSPATH" some suggest "CLASS PATH" as the variable name. I have tried both.

Below is what the classpath looks like in bold.

Variable Name: CLASS PATH

Variable value: c:\download\javamail-1.4\mail.jar;C:\download\jaf-1.1\activation.jar;.

I have double checked all folder names and copy pasted all entries to eliminate typos. Javamail-1.4 and jaf-1.1 are both located in c:\download which is the same location Class Path points to.

Thank you very much for your input and effort. I can imagine how frusterating it is responding to 20million javamail posts :) (that may be a bit of an overstatement!)

Thank you again!

Irbi

Message was edited by:

irbi

Message was edited by:

irbi

[5685 byte] By [irbia] at [2007-11-27 10:06:48]
# 1
There is no space in the environment variable name "CLASSPATH".Did you read the README.txt file that comes with JavaMail?Have you found the JavaMail FAQ?
bshannona at 2007-7-13 0:43:14 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

Yes I have read the Javamail FAQ.

Below is the result of set path.

Path=C:\Program Files\Java\javamail-1.4;C:\Program Files\Java\jdk\bin

I have also tried the path using the .jar extension as below

Path=C:\Program Files\Java\javamail-1.4.jar;C:\Program Files\Java\jdk\bin

I am fairly certain I am setting the path correctly because if I do not set it I cannot use the javac command. However, when i set it for mail.jar the compiler cannot understand import javax.mail.

I also realize I will need to point the path to the jaf folder activation.jar. I figured I would get to one problem at a time.

msgsend.java:45: package javax.mail.internet does not exist

import javax.mail.internet.*;

Thank you so much for all of your efforts. You are much appreciated!

Message was edited by:

irbi

irbia at 2007-7-13 0:43:14 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3

Q: How do I install the JavaMail API implementation?

A: Unzip the distribution zip file and edit your CLASSPATH environment variable to include the mail.jar file that was included with the JavaMail API distribution. You will also need an implementation of the JavaBeans Activation Framework (see below). See the README.txt file (also included in the download package) for additional details and examples.

My path is set to...

Path=C:\Program Files\Java\javamail-1.4;C:\Program Files\Java\jdk\bin

I have also tried pointed the path directly to the .jar file

irbia at 2007-7-13 0:43:14 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...