?
Solved

Problems with running compiled code

Posted on 2005-03-07
2
Medium Priority
?
842 Views
Last Modified: 2013-11-23
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
0
Comment
Question by:richardsimnett
[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
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 13482743
The compiler uses a different VM than when you run your app.
So you need to also place the jar in your JRE's ext directory.
The JRE is probably installed under Program Files.
0
 

Author Comment

by:richardsimnett
ID: 13482903
Objects,
Well that worked. Thanks a million.

Cheers,
Rick
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month10 days, 9 hours left to enroll

765 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