0

I am using intelliJ idea. I am using base path for accessing resources as follow:

String basePath = ".\\src\\main\\resources";

This is my project structure.

Project Structure

My JavaFX project is working perfectly when build in intelliJ with given base path. But when a create exe and run, it throws exception:

The system cannot find the path specified.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
Junaid Khan
  • 315
  • 5
  • 16
  • You should load resources from the classpath instead of the file system path: https://stackoverflow.com/a/59219294/104891. – CrazyCoder Aug 25 '20 at 18:17
  • I am using xlsx file in resources. Can you please write a line of code for accessing this file using classpath – Junaid Khan Aug 26 '20 at 03:12
  • `getClass().getResource("filename.xlsx");` – CrazyCoder Aug 26 '20 at 06:39
  • Its giving this error : java.io.FileNotFoundException: file:\C:\Users\M%20Junaid\Desktop\Xlsx.exe!\Borrowers.xlsx (The filename, directory name, or volume label syntax is incorrect) – Junaid Khan Aug 26 '20 at 06:44

0 Answers0