Hi Andreas, You are right. My problem came from the fact that I am not using separate compilation, or if you prefer, because I am not using maven. And you are right that it is because of the fact that maven is officially used for building PDFBox. But that's a kind of a self-fulfilling prophecy. I could say exactly the opposite, that it was because of separate compilation that I committed the mistake, you see? If the files were already where they should be from the start I wouldn't have got the problem.
I am not against separate compilation. It is excellent for big projects. One advantage is that you can compile only one piece of code (FontBox, for example, as you have mentioned), without the need of compiling everything else, but that is also true in Eclipse with incremental compilation, because once the code is compiled only the modified source code is compiled, not the rest. Also, PDFBox is not actually a very big project and the extra effort of doing separate compilation has some disadvantages. One disadvantage is finding out where some packages are, for example. Again you are right that since they are separate projects they should be put together using some tool, and maven is an excellent tool for that, no doubts. Java has a very ingenious package organization that allows structuring the code in a very natural and smart way. This is missing in C++, for example. However, keeping code or files that would actually be in the same package separately implies not only useless repetition of package hierarchy but also lack of clarity, at least from the point of view of those who are seeing this code for the first time. You guys are used to it because you are working with it everyday and you already know the internal code organization. It is so unfortunate that every Java project breaks such a beautiful package code organization. JVM source code is also structured like that, but it is really a huge code. I can understand that PDFBox is a project that is going to grow, that it is essential to build it with maven, and that it is the correct way to proceed, I agree. On the other hand, I really understood the code in just one day by building it without maven, thanks to your information. This was about understanding the software structure, not about the correct way to build it. Also, I am just constructing a prototype in order to improve it, and I am just by myself. Nice talking with you guys! Thanks again! Cheers, Jack On Sat, Mar 27, 2021 at 7:33 AM Andreas Lehmkuehler <[email protected]> wrote: > Am 26.03.21 um 20:36 schrieb Jack London: > > Hi guys! > > > > *Thank you very very much, Tilman and Andreas!!* > > > > *Andreas was right!* But the hierarchy in Eclipse is not the same as when > > you use separate compilation as in your case. > PDFBox uses maven as build tool and therefore the maven standard directory > layout [1] for all files. The missing files in question are resources and > are > located in > > src/main/resources > > Each subproject such as fontbox, pdfbox, preflight and so on has it own > directory with the very same layout. > > Maven automatically collects all necessary files when creating a jar so > that all > needed files are available when using it. It is not necessary to copy any > files > manually. > > Eclipse supports many different kind of projects. To open a maven based > project > one should use the import wizard as follows > > File -> Import ... -> Maven -> Existing Maven Projects -> Choose the main > directory of the unzipped pdfbox sources > > I've the impression that you are not doing so which led to the described > issues. > > Cheers > Andreas > > [1] > > https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html > > > > > In Eclipse, the basepath starts at *src. *Suppose that your Eclipse > > workspace is called *PDFBox-Workspace*, and that it is somewhere in your > > disk, it doesn't matter. Then, suppose that you created a project called > > *PDFBox* in this workspace for your PDFBox source code. Then, your > > packages/hierarchy starts at: > > > > *PDFBox-Workspace\PDFBox\src* > > > > > > I debugged and there were two resources missing: > > > > "Identity-H",which is actually in the path: > > > > *PDFBox-Workspace\PDFBox\src*\*org\apache\fontbox\cmap\Identity-H* > > > > > > and "sRGB.icc" which is actually in the path: > > > > *PDFBox-Workspace\PDFBox\src\org\apache\pdfbox\resources\cmap* > > > > > > Eclipse completes the partial paths such as > > *org\apache\fontbox\cmap\Identity-H* with the absolute path: > > > > *C:\...\PDFBox-Workspace\PDFBox\src\* > > > > > > *But*, when you copy the file to its place in *src* directory, you > > should *refresh > > *the project on Eclipse "Package Explorer". This will copy the file to: > > > > *C:\...\PDFBox-Workspace\PDFBox\bin* > > > > > > When your code executes it "wants" things in the *bin *directory not in > the > > *src*. That is why you should refresh "Package Explorer". In the case of > > Java files, Eclipse compiles the files and copies the class file to > *bin*. > > But if the file is not a java file it will just copy it there. > > > > Thus, it is possible to compile PDFBox with Eclipse, but the resources > must > > be put in the way I explained above. Timan, you definitely don't need > > maven, 😉 > > > > Hope this will help someone! > > > > Thanks again everybody!! > > > > See you next time, > > > > Jack > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
