I created a spring boot application which reads an excel file for data to be displayed in the front end so basically its the source of persistent data. I am able to run to correctly from my eclipse but when i create a spring boot jar and run it from the command line it fails as the files are not included in the jar.
I have tried two location src/main/resources and /src/main/webapp/WEB-INF/external/ but in both cases the files are not included.
Code :
private static final String FILE1 = "\\src\\main\\webapp\\WEB-INF\\external\\file1.csv";
private static final String FILE2 = "\\src\\main\\webapp\\WEB-INF\\external\\file2.csv";
private static String currentDirectory = Paths.get(".").toAbsolutePath().toString();
private static String completeAbsolutePath = currentDirectory
.substring(0, currentDir.length() - 1)
.replace("\\", "\\\\");
reader = new CSVReader(new FileReader(completePath + FILE1))
Error :
java.io.FileNotFoundException: c:\delete\src\main\webapp\WEB-INF\external\File1.csv
Can someone one please help?