【发布时间】:2018-03-05 11:48:43
【问题描述】:
我创建了一个依赖于Apache HTTP Components 的例程,因此我下载了 jar 文件并将这些文件添加到构建路径中。
我已经在 Java\Build Path 下设置了 Classpath Variables 和 User Libraries,但它仍然不起作用。
我的代码编译没有任何错误,但运行失败,出现以下异常:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/client/RedirectStrategy
at routines.downloadXls.start(downloadXls.java:10)
[...]
这段Java代码如下,它用Eclipse运行:
private CloseableHttpClient createHttpClient() {
HttpClientBuilder builder = HttpClientBuilder.create();
httpCtx.setAttribute(HttpClientContext.COOKIE_STORE, store);
return builder.setRedirectStrategy(LaxRedirectStrategy.INSTANCE).build();
}
我已经看到了similar question on talend community,但它对我没有帮助。
有什么建议吗?
谢谢
【问题讨论】:
标签: java talend apache-httpcomponents