I am implementing the JAWS API as part of my project. I looked at the example program and have written a similar code.
public static String[] generateSynset(String wordForm){
ArrayList<String> al = new ArrayList<String>();
File f = new File("C:\\Users\\ADMINN\\workspace\\NewsExtraction\\WordNet\\2.1\\dict");
System.setProperty("wordnet.database.dir", f.toString());
//setting path for the WordNet Directory
WordNetDatabase database = WordNetDatabase.getFileInstance();
Synset[] synsets = database.getSynsets(wordForm);
But even though my code is consistent with their sample program, I keep getting the following error.
Exception in thread "main" java.lang.NoClassDefFoundError: edu/smu/tspell/wordnet/WordNetDatabase
at Wordnettest.main(Wordnettest.java:11) Caused by: java.lang.ClassNotFoundException: edu.smu.tspell.wordnet.WordNetDatabase
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
... 1 more
I have included the WordNet dictionary database folder correctly.
Can you please help fix this issue?
You have to add that jar into classPath for the project as well as the server if you are using one.
To do so:
Right click on project -> Build path -> Configure Build Path -> Add External JARs -> Select JAWS-version.jar
Run -> Run Configurations -> Select your Server -> Class path tab -> Click on User Entries -> Add External JARs -> Select JAWS-version.jar
All the answers I read when I had the issue failed to mention the Run Configuration for the server.