?
Solved

JAvamail setup in Solaris

Posted on 2002-05-16
10
Medium Priority
?
855 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Quick Cloud Training

Looking for some quick training on the cloud in 2 hours or less? Check out these how-to guides in AWS, Linux, OpenStack, Azure, and more!

 
LVL 35

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 35

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 35

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month8 days, 10 hours left to enroll

764 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