Search code examples
javaeclipsewolframalpha

How to identify the dependent libraries I need


I am building a little something in Java that uses Wolfram|Alpha to come up with integrals. I downloaded the Wolfram API and it comes with a sample program that you can use to figure stuff out. Here's that at GitHub.

There's a portion in the comments that says:

 * To compile or run this program you will need the following dependent 
 * libraries on your classpath (including WolframAlpha.jar, of course):
 * 
 *     commons-codec-1.3.jar
 *     httpclient-4.0.1.jar
 *     httpcore-4.0.1.jar
 *     commons-logging.jar

... and I have no idea how to do this. I'm using this project as a way to learn Java, so I am skipping a bunch of sleep-inducing fundamentals.

Are these libraries available in the vanilla Java install, or do I have to go fetch them from elsewhere? I want to avoid loading up my system with redundant stuff.

When I try to run the script without loading these libraries it ends in an error, predictably. Here's the error message:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/conn/scheme/SocketFactory
    at com.wolfram.alpha.net.HttpProviderFactory.getDefaultHttpProvider(HttpProviderFactory.java:18)
    at com.wolfram.alpha.WAEngine.<init>(WAEngine.java:36)
    at simpleSample.main(simpleSample.java:58)
Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.scheme.SocketFactory
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 3 more

I am using Eclipse as my IDE. I don't think it matters here, but it might.


Solution

  • @dimplex has already answered. These are releases of several Apache projects. Next time you meet these problems, try:

    Google:

    Like:

    The first result for EVERY search above is a couple clicks away from the download you're looking for.

    Maven Central Search:

    http://search.maven.org

    (I'm not copying every link, just search for the Jar file names.)

    This one is even more direct, but I'd recommend the Google way, as you can get a glimpse of the project page.