Link to home
Start Free TrialLog in
Avatar of richardsimnett
richardsimnett

asked on

Problems with running compiled code

Hello there,
I have an MTA application called power mta which has a java api to send email into it. I have placed the jar file provided into the jre/lib/ext directory and the example code compiled without a problem. However, when I run the app I get the following error:

C:\Documents and Settings\Administrator\Desktop\MPFeeder\examples>java ExampleMe
ssage
Exception in thread "main" java.lang.NoClassDefFoundError: com/port25/pmta/api/s
ubmitter/EmailAddressException

What does this error mean? I have called them about this and they say they cant duplicate the error. Here is the ExampleMessage.java code:

import java.io.IOException;
import com.port25.pmta.api.submitter.*;

/*
 * Example for usage of the Java PMTA Submitter API.
 *
 * Copyright 2002 by Port25 Solutions, Inc.
 * All rights reserved.
 *
 * Don't forget to set the LD_LIBRARY_PATH environment variable to include
 * the directory where libpmtajava.so (or pmtajava.dll) is in, e.g. on
 * Linux and with bash use
 *      export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/
 * if it is not in the default library path.
 *
 * $Id: ExampleMessage.java,v 1.15 2004/06/02 14:24:43 robert Exp $
 *
 */
public class ExampleMessage {
    public static void main(String args[]) {
        String text =
            "Subject: Sent using the PMTA Java API\n" +
            "To: To You <rick@infotech.com>\n" +
            "From: From Me <rick@infotech.com>\n" +
            "\n" +
            "This message was sent via PowerMTA's native Java API.\n";
        Message msg = new Message("rick@infotech.com");
        try {
            Recipient rcpt = new Recipient("rick@infotech.com");
            msg.addRecipient(rcpt);
            msg.setReturnType(Message.RETURN_FULL);
            msg.addDateHeader();
            msg.setEncoding(Message.ENCODING_8BIT);
            msg.addData(text.getBytes());
            Connection conn = new Connection("local:");
            conn.submit(msg);
        }
        catch (ServiceException se) {
            se.printStackTrace();
        }
        catch (EmailAddressException eae) {
            eae.printStackTrace();
        }
        catch (IOException ioe) {
            ioe.printStackTrace();
        }
    }
}


Can someone please tell me what I am doing wrong? The correct fix is worth 500 points.

Thanks,
Rick
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of richardsimnett
richardsimnett

ASKER

Objects,
Well that worked. Thanks a million.

Cheers,
Rick