Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
javierron opened this issue Jun 25, 2020 · 0 comments
Open

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

javierron opened this issue Jun 25, 2020 · 0 comments

Comments

@javierron
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant