简体   繁体   中英

JAVA EE & Eclipse: I am getting java.lang.NoClassDefFoundError even though I have set the build path

I am using Eclipse with the Google App Engine plugin. I'm trying to run a simple program with added joda time. It seems like the error relates to the build path and I followed the instructions in: https://stackoverflow.com/a/12105417/3255963 but I am still getting the error below. What do I need to do to next?

package test;
import java.io.IOException;
import javax.servlet.http.*;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

@SuppressWarnings("serial")
public class testServlet extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {

        DateTime newYears = new DateTime (2014, 1, 1, 0, 0);

        resp.setContentType("text/plain");
        resp.getWriter().println("Hello, world");

    }

}       

Error:

java.lang.NoClassDefFoundError: org/joda/time/DateTime

I see the joda-time-2.3.jar in the project explorer and the build path.

I also tried selecting it under order and export.

NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available during compile time. Please ck whether u have the req. jars under \\WebContent\\WEB-INF\\lib in the project explorar as well as on the project build path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM