We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm adding a feature to my Processing library, coded in Java in Eclipse. In my code, I want to be able to start a new page in my PDF output. Processing's documentation says I do the following, where theSketch is my pointer of type PApplet back to my sketch:
PGraphicsPDF pdf = (PGraphicsPDF) theSketch.g;
pdf.nextPage();
But this doesn't compile because the Java compiler reports that PGraphicsPDF is an unknown symbol. Among my many attempted solutions, I copied pdf.jar from the Processing installation (specifically, on my Mac, from /Applications/Processing.app/Contents/Java/modes/java/libraries/pdf/library) into Eclipse's folder Referenced Libraries, added it to the Java Build Path for my project, and imported processing.pdf.* at the top of the file (in addition to processing.core.*), but the compile fails with the error "package processing.pdf does not exist" . Can someone please help me get this code (or something like it) to work?
Answers
Update: I added
pdf.jarto to theclasspath.local.includeline inbuild.properties, and the code builds successfully. But something is still very weird.When I compile, I get the following error. What I find interesting is that the path involves a temporary (tmp) folder which I am unaware of explicitly creating or using:
But the library otherwise compiles (and runs) just fine. If I comment out the import of this "non-existing" library, the compilation fails because
PGraphicsPDFis an unknown type.My guess is that it's not finding the library in this tmp folder, but it's finding it elsewhere, and that's why things are working. But that's just a guess, and I'd rather not release an update to my library until I know it's solid. Can anyone help me understand or resolve the apparent contradiction that a "non-existent" library is necessary to compile my code successfully?
Dunno whether it helps, but when I
import sun.misc.Unsafe;in Processing's IDE, it says:"No library found for sun.misc".
But it works anyways! So I guess it's the same case w/ Eclipse? :-??
Also, in old Processing versions, like 2.0.3 or 1.5.1, using
import statictriggered same warning:import static javax.swing.JOptionPane.*;-> "No library found for static javax.swing.JOptionPane".But lo & behold, works like a charm nonetheless! :O)
However,
import static's warning is fixed now. At least it is in my Processing 2.2.1! =:)