How to use a java library

Hi everyone,

I am trying to 'import' this java library: https://github.com/timmolter/XChange

I have searched these forums and google at large to try and figure this out. To use a java library, it would seem that it should be as easy as either:

a) loading the file(s) into the "sketchbook's" "libraries" folder (for me, C:\Users\Laptop\Documents\Processing\libraries) and doing an import xchange.*;

or

b) drag-and-drop the jar file onto the sketch window which loads it into the sketches /code/ folder, then write import line.

I have tried both of these, and they return: No library found for xchange Libraries must be installed in a folder named 'libraries' inside the 'sketchbook' folder.

plz halp!

Thanks in advance.

Answers

  • edited January 2015

    I once exported a Java library too:

    • From within /libraries subfolder, I've created another 1.
    • From that new subfolder, I had another 1 called /library, which finally had the .jar file.
    • It's also important it seems to have a library.properties file inside the 1st subfolder below /libraries.

    My case below:

    name = acm category=Framework sentence=ACM Java Task Force authorList=[JTF](http://www-cs-faculty.stanford.edu/~eroberts/jtf/) url=http://www-cs-faculty.stanford.edu/~eroberts/jtf/acm.jar version=2 prettyVersion = 1.99.1 (2008-Sep-20)

  • Nope didn't work. It looks like this is going to be more difficult than using a processing library. Doesn't help that I'm also a java noob =)

    So with WinRAR i'm browsing the file xchange-mtgox-1.10.0.jar

    from the github page. Looking at the folder structure and example code on the author's site, I should be able to: import com.xeiam.xchange.mtgox.*;

    but I get the same error as before.

  • edited January 2014

    See if the article How to Install a Contributed Library helps.

    Looking at the site, I see the library has dependencies, ensure you have their jars beside the library jar, too.

Sign In or Register to comment.