Eclipse not knowing about included file

Started by
1 comment, last by incertia 11 years, 5 months ago
Hi I have a problem trying to include a file in Java and eclipse not seeming to recognize it.

I have

import org.apache.commons.httpclient.HttpClient;

and

HttpClient client = new HttpClient();

when it gets to the second line I get the crash


Exception in thread "Thread-4" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

at org.apache.commons.httpclient.HttpClient.<clinit>(HttpClient.java:66)


when I click it tells me that the source attachement does not have HttpClient.class is not found even though I unzipped the jar file referenced and clearly saw it in the directory \org\apache\commons\httpclient. I tried replacing the jar to no avail.

I then took the org folder put it in the src directory of my project workspace and used add library to add it right to the list in the package explorer pane but I reran it and it still cannot seem to recognize that the file it wants is included. What is happening? Thanks
Advertisement
It's not the org.apache.commons.httpclient.HttpClient that is missing but the org.apache.commons.logging.LogFactory class (which is part of the Apache's common-logging library).

You must add the common-logging library's jar (and its dependencies, if there's any) to your project's classpath.
Just import org.apache.commons.logging.LogFactory and that might fix your problem.
what

This topic is closed to new replies.

Advertisement