由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - 找不到HttpClient Class
相关主题
[合集] 帮我看看这个问题出在哪。java reflecton question: how to represent a String[] class?
multiple classes in one file:revistedHelp!! a cookie question
maven还是别的?关于建立一个web app project的模板[转载] Re: 觉得自己很笨
weird class definitionRe: Display, edit, and save Image on HTM
Class not found?java怎么display web page
请教一个简单的问题soap questions, continues
interestingwhich http client package is good to use?
extending generic class , but not mentioning its parameterized type?sevlet question
相关话题的讨论汇总
话题: httpclient话题: class话题: commons话题: 不到话题: main
进入Java版参与讨论
1 (共1页)
c***a
发帖数: 364
1
因为HttpClient4.0没有.commons了,所以使用HttpClient3.0.1。
其实就是run一个例子:
http://hc.apache.org/httpclient-3.x/tutorial.html
编译都通过了,我也能够在HttpClient的包中看到HttpClient这个class,但是运行的
时候就是找不到,报错NoClassDefFoundError。
写了一个很小的测试程序:
package test;
import org.apache.commons.httpclient.*;
public class test {
public static void main(String args[]){
HttpClient client = new HttpClient();
}
}
错误:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/
commons/logging/LogFactory
at org.apache.commons.httpclient.HttpClient.(HttpClient.java
at HttpClientTutorial.HttpClientTutorial.main(HttpClientTutorial.
java:23)
g*****g
发帖数: 34805
2
Make sure commons logging jar is in classpath.

【在 c***a 的大作中提到】
: 因为HttpClient4.0没有.commons了,所以使用HttpClient3.0.1。
: 其实就是run一个例子:
: http://hc.apache.org/httpclient-3.x/tutorial.html
: 编译都通过了,我也能够在HttpClient的包中看到HttpClient这个class,但是运行的
: 时候就是找不到,报错NoClassDefFoundError。
: 写了一个很小的测试程序:
: package test;
: import org.apache.commons.httpclient.*;
: public class test {
: public static void main(String args[]){

c******n
发帖数: 4965
3
noclassdeffound does NOT mean that you don't have .class in path
ClassNotFound means that.
this one actually means that the ctor of the class failed. most likely
some setup issues caused the ctor to fail
this is a very common misconception, u can google that

【在 c***a 的大作中提到】
: 因为HttpClient4.0没有.commons了,所以使用HttpClient3.0.1。
: 其实就是run一个例子:
: http://hc.apache.org/httpclient-3.x/tutorial.html
: 编译都通过了,我也能够在HttpClient的包中看到HttpClient这个class,但是运行的
: 时候就是找不到,报错NoClassDefFoundError。
: 写了一个很小的测试程序:
: package test;
: import org.apache.commons.httpclient.*;
: public class test {
: public static void main(String args[]){

c******n
发帖数: 4965
4
btw
it's almost impossible to develop code without some dependency
management system (ivy/maven)
if you use these,
ant clean
maven clean
would most likely remove doubts about class path issues

【在 c***a 的大作中提到】
: 因为HttpClient4.0没有.commons了,所以使用HttpClient3.0.1。
: 其实就是run一个例子:
: http://hc.apache.org/httpclient-3.x/tutorial.html
: 编译都通过了,我也能够在HttpClient的包中看到HttpClient这个class,但是运行的
: 时候就是找不到,报错NoClassDefFoundError。
: 写了一个很小的测试程序:
: package test;
: import org.apache.commons.httpclient.*;
: public class test {
: public static void main(String args[]){

1 (共1页)
进入Java版参与讨论
相关主题
sevlet questionClass not found?
模拟LOGIN用哪个LIBRARY好?请教一个简单的问题
how to sent progress message back from a servlet to a client?interesting
如何用Proxyextending generic class , but not mentioning its parameterized type?
[合集] 帮我看看这个问题出在哪。java reflecton question: how to represent a String[] class?
multiple classes in one file:revistedHelp!! a cookie question
maven还是别的?关于建立一个web app project的模板[转载] Re: 觉得自己很笨
weird class definitionRe: Display, edit, and save Image on HTM
相关话题的讨论汇总
话题: httpclient话题: class话题: commons话题: 不到话题: main