Open Thorn1089 opened 5 years ago
@TomRK1089 Hello. Have you solved the problem? And how to solve it?
I had to copy the data files out of the JAR, repackage them in my own JAR, and extract them to the filesystem at startup. There was no simple workaround.
Thank you very much.
Because of changes made to how
Class.getResource(String)
works in Java 9 and above, simply including thesphinx-data
JAR does not work to load the English acoustic model, dictionary, etc.The problem is here:
Using a location such as
resource:/edu/cmu/sphinx/models/en-us/en-us
will no longer work. This is becauseClass.getResource
will delegate to the classloader and pass the module name (in this case derived from the JAR file as "sphinx.core"). The problem is that the resources are in a different JAR, which gets the automatic module name "sphinx.data". Since the classloader will only look within the "sphinx.core" module, it won't find the resources from "sphinx.data."