Improve company productivity with a Business Account.Sign Up

x
?
Solved

JAvamail setup in Solaris

Posted on 2002-05-16
10
Medium Priority
?
903 Views
Last Modified: 2013-12-05
Hi Experts,

I am trying to run a java application to send out emails for me.
I have downloaded the javamail api and install in my system (solaris).

I tried to compile the msgshow.java(come with it) but I always enocunter the following errors.

# javac msgshow.java
msgshow.java:33: package javax.mail does not exist
import javax.mail.*;
^
msgshow.java:34: package javax.mail.internet does not exist
import javax.mail.internet.*;
^
msgshow.java:35: package javax.activation does not exist
import javax.activation.*;
^
msgshow.java:214: cannot resolve symbol
symbol  : class Part  
location: class msgshow
    public static void dumpPart(Part p) throws Exception {
                                ^
msgshow.java:288: cannot resolve symbol
symbol  : class Message  
location: class msgshow
    public static void dumpEnvelope(Message m) throws Exception {
                                    ^
msgshow.java:110: cannot resolve symbol
symbol  : class Session  
location: class msgshow
            Session session = Session.getDefaultInstance(props, null);
            ^
msgshow.java:110: cannot resolve symbol
symbol  : variable Session  
location: class msgshow
            Session session = Session.getDefaultInstance(props, null);
                              ^
msgshow.java:114: cannot resolve symbol
symbol  : class MimeMessage  
location: class msgshow
                MimeMessage msg = new MimeMessage(session, System.in);
                ^
msgshow.java:114: cannot resolve symbol
symbol  : class MimeMessage  
location: class msgshow
                MimeMessage msg = new MimeMessage(session, System.in);
                                      ^
msgshow.java:120: cannot resolve symbol
symbol  : class Store  
location: class msgshow
            Store store = null;
            ^
msgshow.java:122: cannot resolve symbol
symbol  : class URLName  
location: class msgshow
                URLName urln = new URLName(url);
                ^
msgshow.java:122: cannot resolve symbol
symbol  : class URLName  
location: class msgshow
                URLName urln = new URLName(url);
                                   ^
msgshow.java:141: cannot resolve symbol
symbol  : class Folder  
location: class msgshow
            Folder folder = store.getDefaultFolder();
            ^
msgshow.java:155: cannot resolve symbol
symbol  : variable Folder  
location: class msgshow
                folder.open(Folder.READ_WRITE);
                            ^
msgshow.java:156: cannot resolve symbol
symbol  : class MessagingException  
location: class msgshow
            } catch (MessagingException ex) {
                     ^
msgshow.java:157: cannot resolve symbol
symbol  : variable Folder  
location: class msgshow
                folder.open(Folder.READ_ONLY);
                            ^
msgshow.java:177: cannot resolve symbol
symbol  : class Message  
location: class msgshow
                Message[] msgs = folder.getMessages();
                ^
msgshow.java:180: cannot resolve symbol
symbol  : class FetchProfile  
location: class msgshow
                FetchProfile fp = new FetchProfile();
                ^
msgshow.java:180: cannot resolve symbol
symbol  : class FetchProfile  
location: class msgshow
                FetchProfile fp = new FetchProfile();
                                      ^
msgshow.java:181: package FetchProfile does not exist
                fp.add(FetchProfile.Item.ENVELOPE);
                                   ^
msgshow.java:182: package FetchProfile does not exist
                fp.add(FetchProfile.Item.FLAGS);
                                   ^
msgshow.java:194: cannot resolve symbol
symbol  : class Message  
location: class msgshow
                Message m = null;
                ^
msgshow.java:215: cannot resolve symbol
symbol  : class Message  
location: class msgshow
        if (p instanceof Message)
                         ^
msgshow.java:216: cannot resolve symbol
symbol  : class Message  
location: class msgshow
            dumpEnvelope((Message)p);
                          ^
msgshow.java:248: cannot resolve symbol
symbol  : class Multipart  
location: class msgshow
            Multipart mp = (Multipart)p.getContent();
            ^
msgshow.java:248: cannot resolve symbol
symbol  : class Multipart  
location: class msgshow
            Multipart mp = (Multipart)p.getContent();
                            ^
msgshow.java:258: cannot resolve symbol
symbol  : class Part  
location: class msgshow
            dumpPart((Part)p.getContent());
                      ^
msgshow.java:291: cannot resolve symbol
symbol  : class Address  
location: class msgshow
        Address[] a;
        ^
msgshow.java:299: package Message does not exist
        if ((a = m.getRecipients(Message.RecipientType.TO)) != null) {
                                        ^
msgshow.java:313: cannot resolve symbol
symbol  : class Flags  
location: class msgshow
        Flags flags = m.getFlags();
        ^
msgshow.java:315: package Flags does not exist
        Flags.Flag[] sf = flags.getSystemFlags(); // get the system flags
             ^
msgshow.java:320: package Flags does not exist
            Flags.Flag f = sf[i];
                 ^
msgshow.java:321: package Flags does not exist
            if (f == Flags.Flag.ANSWERED)
                          ^
msgshow.java:323: package Flags does not exist
            else if (f == Flags.Flag.DELETED)
                               ^
msgshow.java:325: package Flags does not exist
            else if (f == Flags.Flag.DRAFT)
                               ^
msgshow.java:327: package Flags does not exist
            else if (f == Flags.Flag.FLAGGED)
                               ^
msgshow.java:329: package Flags does not exist
            else if (f == Flags.Flag.RECENT)
                               ^
msgshow.java:331: package Flags does not exist
            else if (f == Flags.Flag.SEEN)
                               ^
38 errors


anyone encounter that before ?
help needed urgently.

Thanks
0
Comment
Question by:seahpc
  • 4
  • 3
  • 2
  • +1
10 Comments
 

Expert Comment

by:johanvdv
ID: 7015597
Hello,

The Java compiler is trying to find the packages you are importing but he cannot find them.
You have to add the mail.jar and the activation.jar (these files are bundled in the API you downloaded) to the classpath before compiling the source file.
The packages you want to import are available in these jar's so you should be able to compile the source file then.

Johan
0
 
LVL 2

Author Comment

by:seahpc
ID: 7015612
i tried that, but still got the error....
0
 
LVL 2

Author Comment

by:seahpc
ID: 7015638
i tried that, but still got the error....
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 36

Expert Comment

by:girionis
ID: 7015727
 Tell us the exact steps you are taking.
0
 
LVL 2

Author Comment

by:seahpc
ID: 7015819
hi all,

thanks, i have manage to get it up.

thanks again for all ur kindness and help
0
 
LVL 36

Expert Comment

by:girionis
ID: 7015842
So what exactly were you doing wrong?
0
 
LVL 2

Author Comment

by:seahpc
ID: 7016055
i follow the steps by coping the class files into some directory then set the classpath to the location. it doesn't work.

I the came across an article in some web pages, saying copy the files into the jre/lib/etx directory.
with this it works.
0
 

Expert Comment

by:johanvdv
ID: 7016729
Hello,

The problem was your classpath. Just putting the classpath to the location of the JAR is not enough. You have to mention the complete jar file name in the classpath like this:

on Windows: set classpath=c:\myfolder\myJar.jar;c:\myfolder\mysecondjar.jar

and so on...

When you copy the JARS to the jre\lib\ext folder, the Java Runtime automatically uses the Jars in this folder in his classpath...

Johan
0
 
LVL 36

Expert Comment

by:girionis
ID: 8766657
No comment has been added lately, so it's time to clean up this TA.

I will leave a recommendation in the Cleanup topic area that this question is:

- To be PAQ'ed and points refunded

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0
 

Accepted Solution

by:
SpideyMod earned 0 total points
ID: 8819797
PAQ NO refund.

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

606 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question