I am trying to solve a problem that seems very strange to me. I looked at least five similar topics here on StackOverflow, and none of them gave an answer. But to the problem itself: I want to read in the file when the application starts. When I run the application in the IDE (IntelliJ Idea), everything is fine. Although, when I create it using Gradle, Java throws a FileNotFoundException:
java.io.FileNotFoundException: file:/home/user/IdeaProjects/time-keeper/build/libs/time-keeper-0.7-beta.jar!/data.csv (No such file or directory)
The file path is correct, the file exists, the jar has the appropriate permissions. Announcement:
File dataFile = new File(ClassLoader.getSystemResource("data.csv").getFile());
Handle<TimeTask> dataHandle = new FileHandle(dataFile);
source
share