To use JAWS the specification of the WordNet database directory within the application is needed as stated here: http://lyle.smu.edu/~tspell/jaws/.
System.setProperty("wordnet.database.dir", "resources/WordNet-3.0/dict/");
This works well within an IDE. But not compiled to a .jar file. Therefore, the relative path of the WordNet directory within the .jar file is needed. Tried already various approaches. The last is:
String url = this.getClass().getClassLoader()
.getResource("resources/WordNet-3.0/dict/index.sense").toExternalForm();
url = url.substring(0, url.length() - 12);
Which has as result tested from the .jar file:
jar:file:/C:/file/path/jar.jar!/resources/WordNet-3.0/dict/
Thought this would be the solution, but still the directory or rather the index.sense can not be found when the .jar is run. The index.sense is supposed to load through:
WordNetDatabase database = WordNetDatabase.getFileInstance();
Which makes use of the specified directory. Found a couple of threads but no suggestions of those worked. For example:
How to get the path of a running JAR file? How to get a path to a resource in a Java JAR file Loading a file relative to the executing jar file