On 04/18/2012 08:06 PM, Stephan Greene wrote:
On Apr 18, 2012, at 1:21 PM, Jörn Kottmann wrote:
Its strange that it cannot load it. Based on your other post you could assume
that it
has to do with your classpath. Do you use a different opennlp-tools.jar file?
Or is something wrong with the line which tries to retrieve the version file?
I have the same jar files across both methods of invocation so it's not the
classpath. But your question about the getResourceAsStream() line got me
thinking. I researched it a bit, and found that the behavior of this method
will vary depending on what ClassLoader is active in the current context. Which
ClassLoader you get is in turn affected by any number of things, including
third party libraries and eclipse plugins.
If I restrict my command line classpath specification explicitly to the minimal
set of UIMA and OpenNLP jars that I need, it runs fine. I had been using
wildcard syntax. I'm not sure how unreferenced libs could affect the
ClassLoader, however. So, not the most satisfying resolution, but a resolution
nonetheless. Given the nature of the issue, I would have expected the eclipse
context to exhibit the problem, not the command line, though perhaps eclipse
takes extra care in ClassLoader management.
I still don't get it. We do:
Version.class.getResourceAsStream("opennlp.version");
This call uses the classloader which loaded the Version class to look
for the opennlp.version
file in the same package. How can that fail if the file is there?
Jörn