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\Des ktop\MPFee der\exampl es>java ExampleMe
ssage
Exception in thread "main" java.lang.NoClassDefFoundE rror: com/port25/pmta/api/s
ubmitter/EmailAddressExcep tion
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.submit ter.*;
/*
* 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_LIBRAR Y_PATH:/us r/local/li b/
* 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.c om");
msg.addRecipient(rcpt);
msg.setReturnType(Message. RETURN_FUL L);
msg.addDateHeader();
msg.setEncoding(Message.EN CODING_8BI T);
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
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\Des
ssage
Exception in thread "main" java.lang.NoClassDefFoundE
ubmitter/EmailAddressExcep
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.submit
/*
* 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_LIBRAR
* 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.c
msg.addRecipient(rcpt);
msg.setReturnType(Message.
msg.addDateHeader();
msg.setEncoding(Message.EN
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well that worked. Thanks a million.
Cheers,
Rick