How do I use the core net library in another library?

Hi, I'm trying to create a library that uses the core net module, but I'm not sure how to do it properly.

This is the setup I have:

  • I'm using the official template inside eclipse
  • As recommended in the build.properties file, I have a libs folder, with core.js and net.jar (taken from /Applications/Processing.app/Contents/Java/modes/java/libraries/net/library/net.jar)
  • Updated classpath.local.include in build.properties with net.jar
  • Added libs/net.jar it to the build path as an external jar file

The ant build builds fine, but when I try to run it in processing, I get the error ClassNotFoundException: processing.net.Client, unless I include import processing.net.Client in my sketch.

I've also noticed that the arduino library does a similar thing with requiring the core serial module (https://github.com/firmata/processing/blob/master/build.xml#L14), and they also explicitly include import processing.serial.*; in their examples. Is this the proper way of doing it?

I also dug around a bit and the arduino jar file contains a Arduino$SerialProxy.class file in the [Processing lib]/Arduino/cc/arduino folder, which I can't see anywhere in the source code. Is this something I need too?

Another hack to the solution was to put a duplicate of net.jar inside the lib (note: not libs) folder, and the build script builds correctly, and the processing sketch runs it without error, but there are conflicts with the core processing library.

Sign In or Register to comment.