Skip to content

Problem with loading resource files from Structure.java class #232

Description

@javierron

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions