We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProcessing DevelopmentLibraries,  Tool Development › Import Libraries with Multiple .jar files
Page Index Toggle Pages: 1
Import Libraries with Multiple .jar files (Read 1703 times)
Import Libraries with Multiple .jar files
Apr 24th, 2009, 2:01pm
 
While updating my library, romeFeeder, I came across a small problem to which I can't seem to find the answer.

romeFeeder is built upon the ROME library, which is itself built using another lib. that means that at the moment, the library/ folder of romeFeeder includes three .jar files.

when using the Import Library function from the Processing IDE menu, the only one that is imported is the main romefeeder.jar, but the others need to be added by hand.

is there a way to tell the Import Library function which particular lines of code to add, or should the Import Library functions automatically import all .jar files, not just the one with the library's name?
Re: Import Libraries with Multiple .jar files
Reply #1 - Apr 25th, 2009, 2:21am
 
I am not sure of what is bugging you exactly.
FYI, if you use a library, you only need import statements for this library if the other libraries are used only internally.
In other words, if library Foo is using Bar but doesn't expose Bar's objects, only Foo's code need to import Bar.
If you need to create Bar objects and feed Foo with it, then you need to import Bar as well. Otherwise, that's just an internal dependency and you don't need to worry with it.
Re: Import Libraries with Multiple .jar files
Reply #2 - May 1st, 2009, 9:00am
 
I should have been more clear, but you put your finger right on the problem.

My library (romefeeder) uses two libraries internally. Up to here no problem.

But. romefeeder also returns objects with classes declared by those libraries. For example, calling feeder.next(), feeder being of a class in the romeFeeder library, return a SyndEntry object, which is in the ROME library. Therefore, both needs to be imported in the header of the sketch, but the import library function in the menu only add the line to the main jar file, not the others in the library folder.

Just pointing out that the import library function doesn't ackowledge for all possibilities. I'm gonna go and wrap those beautiful little classes in some of my own.
Page Index Toggle Pages: 1