Solved

JAvamail setup in Solaris

Posted on 2002-05-16
10
825 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
topping1 challenge 7 53
wordmultiple challenge 12 92
Unable to start eclipse ? 17 87
Groovy:unable to resolve class error 2 31
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

747 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now