У меня проблема с импортом RiTa в программу Java. Я использую командную строку в Ubuntu 17.10.
rita.jar rita.support.jar test.class test.java
john@COMPUTER:~/CS/249/bored$ jar tvf rita.jar
0 Mon Jul 16 23:13:02 EDT 2018 META-INF/
104 Mon Jul 16 23:13:00 EDT 2018 META-INF/MANIFEST.MF
7684 Mon Jul 16 23:13:00 EDT 2018 JWNLResource_en.properties
561 Mon Jul 16 23:13:00 EDT 2018 PrincetonResource_en.properties
0 Mon Jul 16 23:13:00 EDT 2018 rita/
17289 Mon Jul 16 23:12:42 EDT 2018 rita/RiGrammar.class
19439 Mon Jul 16 23:12:42 EDT 2018 rita/RiLexicon.class
25441 Mon Jul 16 23:12:42 EDT 2018 rita/RiMarkov.class
18392 Mon Jul 16 23:12:44 EDT 2018 rita/RiString.class
713 Mon Jul 16 23:12:44 EDT 2018 rita/RiTa$1.class
670 Mon Jul 16 23:12:44 EDT 2018 rita/RiTa$RiTaLoaderSource.class
44101 Mon Jul 16 23:12:44 EDT 2018 rita/RiTa.class
3146 Mon Jul 16 23:12:44 EDT 2018 rita/RiTaEvent.class
706 Mon Jul 16 23:12:44 EDT 2018 rita/RiTaException.class
860 Mon Jul 16 23:12:44 EDT 2018 rita/RiText$1.class
54832 Mon Jul 16 23:12:44 EDT 2018 rita/RiText.class
1243 Mon Jul 16 23:12:44 EDT 2018 rita/RiWordNet$ComparableIndexWord.class
50132 Mon Jul 16 23:12:44 EDT 2018 rita/RiWordNet.class
603 Mon Jul 16 23:13:00 EDT 2018 rita/open.gif
1114374 Mon Jul 16 23:13:00 EDT 2018 rita/rita_dict.js
300561 Mon Jul 16 23:13:00 EDT 2018 rita/rita_lts.js
388 Mon Jul 16 23:13:00 EDT 2018 rita/save.gif
john@COMPUTER:~/CS/249/bored$ javac -cp "./*" test.java
john@COMPUTER:~/CS/249/bored$ java test
Exception in thread "main" java.lang.NoClassDefFoundError: rita/RiString
at test.main(test.java:5)
Caused by: java.lang.ClassNotFoundException: rita.RiString
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
Как видите, rita.jar
содержит RiString
. test.java
просто пытается импортировать rita.*
и затем создать RiString
.