Solved

JAvamail setup in Solaris

Posted on 2002-05-16
10
838 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

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

Suggested Solutions

Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
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…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

679 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