I'm trying to create a plain Main.java
file with 2 jar dependencies. I have the program up and running in an Eclipse Java project but when running from command-line as a single java file it can't find a resource path.
The problematic code:
Configuration conf = new Configuration();
conf.setAcousticModelPath("resource:/edu/cmu/sphinx/models/en-us/en-us");
conf.setDictionaryPath("custom.dic");
conf.setLanguageModelPath("custom.lm");
Now the /edu/cmu/sphinx/models/en-us/en-us
is part of the sphinx4-data.jar
. This path just can't be found when I'm running this as a plain Java file on my Raspberry Pi.
Compile:
javac -cp ".:/home/ivaro18/sphinx4-core.jar:/home/ivaro18/sphinx4-data.jar" Main.java
Run:
java -cp ".:/home/ivaro18/sphinx4-core.jar:/home/ivaro18/sphinx4-data.jar" Main
But the error returned:
Can't locate resouce:/edu/cmu/sphinx/models/en-us/en-us
This worked perfectly in Eclipse Java project, having added these 2 jars to my classpath. But when I'm running this as a plain Java file on my pi, it can't find the resource.