Eclipse setup and Processing core.jar for Libraries

Hi Jeremy
I am not an expert in Eclipse. I can provide a suggestion why some libraries don’t include the core.jar. I would bet they built the library via CLI. How does it work? You provide the proper instruction to build your library making sure you define your classpath properly aka. pointing to a location where you can find your core.jar file. If this file changes location in your computer, then you will need to adjust your classpath manually next time you build the library. Is that easy. Now, after I build a library, I do not need to “build” the jars again. I place the generated jar (my library’s jar) into processing-sketch-path/libraries folder (as described in the library-guidelines or overview) and then I can access the library from any sketch in my PDE.

Now, in eclipse I can see that they want to setup a workspace that is independent of any changes or updates that your computer goes through. For instance, if your core.jar library that is used to run a PDE session lives outside of eclipse (it should), then any updates to that library would not “corrupt” your workspace as the workspace has a copy of the jar library to run your project. Yes, I can see this is redundant and I am willing to bet it is the way it was designed. You have always a working workspace but now you are responsible to maintaining two versions of the core library. Not the way I would do it and it seems that is not the way that you want either.

Related to Shifman’s way of doing things… I am willing to bet that, bc he is using a mac, he is probably using soft links to make the core.jar library available to those libraries. I have seen this is an approach available to linux-like systems and an easy way to keep multiple versions of a software available in a machine. For instance, you could soft-link your java master folder to jdk-1.6 or jdk-1.8 if you wanted to switch between different java versions in your (linux) computer. You are not moving or creating duplicate files but you are just creating a link that points to those resources.

In short, if I were to create a library, I will do it via CLI and then I provide a readme with the cli commands. Whoever wants to build the library, he/she needs to setup the classpath properly. It is not difficult and that is why I would not include the core.jar as part of the library. However, this probably applies to small source code. I might use eclipse if I were building a larger project.

Notice that if you are using P3D in your library, I believe you need to include other libraries beside the core.jar. If you export a simple pde example, you can see those extra jar files in the generated export/ folder under the libs folder (I think). I just thought of mentioning this as you might need to keep track not only of core but also of these jar files.

Looking forward to hearing comments from other users.

Kf

3 Likes