1
我正在使用Eclipse和Google App Engine插件。我正在尝试运行一个简单的程序,增加约达时间。这似乎是错误与构建路径有关,我遵循以下指令: https://stackoverflow.com/a/12105417/3255963 但我仍然收到以下错误。接下来我需要做些什么?JAVA EE&Eclipse:即使我已经设置了构建路径,我仍然得到java.lang.NoClassDefFoundError
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");
}
}
错误:
java.lang.NoClassDefFoundError: org/joda/time/DateTime
我看到Project Explorer中的乔达时间 - 2.3.jar和构建路径。
我也尝试在订单和出口下选择它。
谢谢!那样做了。未来有没有自动的方法来做到这一点?我是否还需要在libs文件夹中包含jar? (我会喜欢你,但我的声望还不够高。) – CarbonandH20
据我所知,没有自动的方法来做到这一点,每次你在你的Java Web应用程序中使用jar时,你需要将它添加到lib文件夹以及构建路径。这是因为当您以war文件的形式导入项目时,IDE会自动将lib文件夹下的jar包装到您的Web应用程序中。 – Kushal