Since it wasn't obvious to me how to do this, maybe others would like my example as to how to proceed.
I created a project (not a java project) in Eclipse with the name 'osgi-in-action', corresponding to the top-level folder in the book's sample code. I then copied all the files from the book's osgi-in-action folder, except for chapter02 through chapter15, into my project folder. Using Ant, I ran the build.xml file in the modularity folder. It produced a main.jar file.
In the CLI I executed java -jar main.jar, which produced the expected result,
"Hello, modularity!" (Success!)
I had already produced an OK main.jar file using Ant on the CLI, separate from Eclipse. But Eclipse is handy for editing source files and build files, running Ant, etc.
I assume that the strategy above should work for the sample code in all fifteen chapters.
There are so many code examples from the authors (Thanks!) that I should end up knowing how to build my own OSGi-based code.
- Bob
|