We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi,
I'm trying to put together a basic library and followed the instructions on github, but ran into some issues.
I'm using Option B (the downloaded package) of the processing-library-template. Importing the zip didn't work, perhaps a bug with the eclipse version I'm using ? (Luna Service Release 1 (4.4.1) Build id: 20140925-1800 on OSX 10.10.5) I have copied the folders contained in the zip, maintaining the original src folder from the Java project.
The issue I'm having is with compilation and library dependencies. I'm using the core and serial libraries. This are the options I've tried:
Adding external projects : imported the processing-core and processing-serial eclipse projects from the github repo.
This method allows me to test within eclipse, but the ant build fails (it doesn't seem to 'see' the projects)
Copying libraries to the eclipse project: copied jar file for the libraries used Core (core.jar) and Serial(jssc.jar and serial.jar + JNI libs) to the eclipse project.
This works to certain degree: the library compiles and the examples compile in Processing, but whenever I try to import processing.serial.* in any other Processing sketch, I get a dialog about a serial being a duplicate library (because the jar files copied to the eclipse projects get copied to the Processing library folder. If I manually remove these jars, I get a class not found error:
java.lang.NoClassDefFoundError: processing/serial/Serial
Adding external jars: I've added the external jar files from the Processing.app folder
Reading the Adding core.jar and other .jar files to your classpath section of the processing-library-template had this section which I might have been missing before:
Adjust the build.xml file accordingly.
It doesn't say how to adjust the build.xml file though (and the links in that section still point to the Google Code pages).
My attempt do adjust build.xml goes like this:
classpath.serial.location=/Applications/Processing.app/Contents/Java/modes/java/libraries/serial/library
<path id="classpath">
<fileset dir="${classpath.local.location}" includes="${classpath.local.include}" />
<fileset dir="${classpath.serial.location}" includes="**/*.jar" />
<fileset dir="${classpath.libraries.location}" includes="**/*.jar" />
<fileset dir="${project.lib}" includes="**/*.jar" />
</path>
Running ant mentions the build is successful, but I see some javadoc errors:
package processing.serial does not exist
[javadoc] import processing.serial.Serial;
[javadoc] ^
cannot find symbol
[javadoc] symbol : class Serial
The bigger issue is I get the same class not found error when trying to compile the library examples in Processing:
java.lang.NoClassDefFoundError: processing/serial/Serial
If I manually add the serial import to the example (import processing.serial.Serial;
) the code runs, but I'm guessing
this shouldn't be necessary if the class in my library is already importing this ?
In short: I don't think I'm using the processing-library-template setup correctly and I'm confused to what the best practices are for compiling and distributing a library that has a dependency (serial library in this case).
How do I correctly build my own Processing library with it's dependency ?
Thank you, George