The File API is being used to load resource files, however this breaks when the code is compiled to (and run from) a .jar; getResourceAsStream() can be considered to be used instead.
Example:
|
public void load(String filePath) { |
|
try { |
|
File vectorFile = new File(filePath); |
|
String string = FileUtils.readFileToString(vectorFile, Charset.defaultCharset()); |
|
String[] substrings = string.split(" "); |
|
parameterArray = Arrays.stream(substrings).mapToDouble(Double::valueOf).toArray(); |
|
} catch (IOException e) { |
|
e.printStackTrace(); |
|
} |
|
} |
Here, if the filePath variable has a form similar to file:/coming.jar!/prophet4j/... the File API won't know what to do.
The File API is being used to load resource files, however this breaks when the code is compiled to (and run from) a .jar; getResourceAsStream() can be considered to be used instead.
Example:
coming/src/main/java/fr/inria/prophet4j/utility/Structure.java
Lines 298 to 307 in de22408
Here, if the
filePathvariable has a form similar tofile:/coming.jar!/prophet4j/...the File API won't know what to do.