What's the best way to handle multiple libraries using the same imports

Hi,

It seems inside the Processing editor (PDE) one can use a single library that uses an underlying java library. Here’s an example:

I know one workaround would be for one of these Processing libraries to use the JBox2D underlying java library and the other two Processing libraries to use the first as a dependency, however coordinating something like this sounds unlikely.

Is there a an elegant solution to this limitation when designing a library ?

Many thanks,
George

1 Like

I believe that this is here:

cross-linking:

The issue is not just that they are using the same underlying library – it is also that they might be using different versions of that library.

Previous discussions:

One approach would be to create a fork of any or all of them, Box2DThin, FisicaThin, LiquidFunThin that are all built with JBox2D imported, e.g.

classpath.local.include=jbox2d.jar

Then you can mix installing any number of Thins plus one original, or all the Thins plus just the jbox2D.jar… assuming they are using the same. So the Thins would be available as a workaround option for exactly this issue.

Another approach would be creating something like “MultiBox2D” – a composite fork that bundles Box2D, Fisica, and LiquidFun along with JBox2D as a shared external dependency to all three… and anything else you want to throw in there. Anyone who wants any of them installed simultaneously could then use that one library, which installs them all.

2 Likes