The JVM searches the classpath for required classes, in your case
the opennlp jars are not on the classpath and thats why the runtime
cannot find the SentenceModel class.
Just add at least the maxent and opennlp-tools jars to your classpath
and it will stop complaining about missing opennlp classes.
Jörn
On 12/7/10 10:08 PM, Congmin min wrote:
Sorry for the previous messy reply. This is a clear version.
but now have a running problem:
C:\myclasses>java Test
Initializing the NLP tools ...
Exception in thread "main" java.lang.NoClassDefFoundError:
opennlp/tools/sentdet
ect/SentenceModel
at Test.initialize(Test.java:42)
at Test.main(Test.java:34)
Caused by: java.lang.ClassNotFoundException:
opennlp.tools.sentdetect.SentenceMo
del
... 2 more
if i run it by passing the parameter, i also got an error:
C:\myclasses>java -classpath opennlp-tools-1.5.0.jar Test
Exception in thread "main" java.lang.NoClassDefFoundError: Test
Caused by: java.lang.ClassNotFoundException: Test
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: Test. Program will exit.