Adding contributed libraries into another contributed galleries – Best Practices

Hi, I am developing a contributed library for Processing using this template here:

https://github.com/processing/processing-library-template

My library uses another contributed library, the OpenCV library by Greg Borenstein).

I wonder which is the best practice here:

  1. Add the jar file in the /lib folder and add it in the Build Path in Eclipse. The problem here is that doing this I have to actually add the native opencv jar file (opencv-245.jar) and other files related to this, and I think it's unnecessary since they are already added in the OpenCV library for Processing. Then I can import my library from any sketch with:

import StageDetector.*;

  1. Add the jar files as external (for example, from Documents/Processing/opencv_processing/library/). When I use my library, I have to import it and the OpenCV one with:

import gab.opencv.* import StageDetector.*;

I hope this explanation is clear enough and hope it can help others with same problems.

Thanks for your time!

Tagged:

Answers

  • Answer ✓

    The second version is preferable, however then you will be even more exposed to any changes in the OpenCV library, which might be a good thing. Note processing has difficulties in dealing with multiple copies (and versions) of jars, and the user is sometimes forced to remove one or other libraries when there are conflicting versions (eg jbox2d used by fisica and Box2d-for-Processing), in order to get a library to work.

Sign In or Register to comment.