Thanks for that detailed response. With that new jar file I have it working now.


Thanks again,

Chris

> On Jan 21, 2017, at 7:59 AM, Svante Schubert <[email protected]> 
> wrote:
> 
> Hello Chris,
> 
> I have tested the example myself.
> 
> First I added it to a regression test of the example sources
> <http://svn.apache.org/viewvc/incubator/odf/trunk/simple/src/test/java/org/odftoolkit/simple/DocumentTest.java?revision=1779737&view=markup#l584>
> to the project. It proofs the example source code works fine with the
> latest sources.
> Afterwards I have tested the example on commandline and found the potential
> problem.
> 
> The current sources don't work with commandline with the given classpath.
> 
> The problem you mention is that the ODF document template is not being
> found, which is part of the ODFDOM jar and can be found on its root level
> (exchange file suffix to ZIP and look for yourself). The reason of this
> template is: When you call "TextDocument.newTextDocument()" an XML DOM is
> created from a ODT document within the JAR that is just an empty text
> document with some additional basic styles. So you do not have to start a
> document cumbersome by skretch.
> Still, if you add the ODFDOM jar to the command line classpath and would
> use the latest sources like I do, you would realize that the xerces parser
> JAR was split into different JARs (ie. xml-apis.jar will be missing).
> Afterwards there will be some RDF jar missing and than I thought it would
> be better to solve the problem differently. ;)
> 
> If you like to work comfortable from the command line, just build the
> latest sources as explained at
> https://incubator.apache.org/odftoolkit/source.html
> 1) svn co https://svn.apache.org/repos/asf/incubator/odf/trunk
> odftoolkit20170121
> 2) cd odftoolkit20170121
> 3) mvn install
> 
> Afterwards you will find a JAR with all dependencies at this path:
> odftoolkit20170121\simple\target\simple-odf-0.8.2-incubating-SNAPSHOT-jar-with-dependencies.jar
> So there is only one JAR to be added to the classpath by commandline. I
> have tested it now, it works!
> 
> So thank you for your feed-back, Chris.
> This convinced me that although I am always working with the latest
> sources, it makes sense to provide a new release perhaps with such an
> all-inclusive jar.
> In addition your comment reminded me to update the web pages
> <https://incubator.apache.org/odftoolkit/docs/edit-cms.html>, which might
> be wise to do right after the release.
> 
> All the best,
> Svante
> 
> 
> 
> ᐧ
> 
> 2017-01-21 0:58 GMT+01:00 Chris Cameron <[email protected]>:
> 
>> Hi,
>> 
>> I have tried to follow the "Getting started" example at
>> https://incubator.apache.org/odftoolkit/simple/gettingstartguide.html,
>> but I have struggled to get around the error:
>> 
>> Jan 20, 2017 3:43:26 PM org.odftoolkit.odfdom.pkg.OdfPackageDocument$Resource
>> createInputStream
>> SEVERE: Could not find resource: /OdfTextDocument.odt
>> ERROR: unable to create output file.
>> 
>> Which occurs when I try to run the compiled example code.
>> 
>> Let me start by saying I know some Java, but very little about Maven or
>> any of the libraries used in the ODF toolkit.
>> 
>> So I've tried:
>> * Paring down the code example to just "TextDocument.newTextDocument()",
>> and then stopping. No other action is performed.
>> * Using Java 6, 7, and 8
>> * Compiled ODF toolkit 0.6.1, 0.6, and 0.5 (Using 'mvn compiler:compile',
>> 'mvn jar:jar', and then setting my CLASSPATH to the newly made jars)
>> * On the chance "/OdfTextDocument.odt" was an actual file path it was
>> trying to load, I moved “OdfTextDocument.odt” to my root directory with
>> ‘rw’ permissions.
>> 
>> Same error on every point. I’d be inclined to say "Oh, it's broken", but
>> running 'mvn test' shows many tests that are completing correctly, in
>> particular "org.odftoolkit.simple.DocumentCreationTest"
>> 
>> 
>> I hope I covered all the obvious things, but it's still feeling like I've
>> missed something simple. Can someone help me out with this?
>> 
>> 
>> Appreciate it!
>> 
>> Chris

Reply via email to