I tried using the JWI library for WordNet but I always seem to have an IOException despite catching it. The dictionary won't open.
wnhome = "C:/Program Files (x86)/WordNet/2.1";
path = wnhome + File.separator + "dict";
try {
url = new URL("file", null, path);
} catch (MalformedURLException e) {
e.printStackTrace();
}
IDictionary dict = new Dictionary(url);
try {
dict.open();
} catch (IOException ex) {
textView.setText("Failed");
}
textView.setText("" + dict.isOpen());
// look up first sense of the word "dog"
IIndexWord idxWord = dict.getIndexWord("dog", POS.NOUN);
IWordID wordID = idxWord.getWordIDs().get(0);
IWord word = dict.getWord(wordID);
textView.setText("Id = " + wordID);
textView.setText("Lemma = " + word.getLemma());
textView.setText("Gloss = " + word.getSynset().getGloss());
Weird side of this is these codes perfectly runs on Netbeans.