I have a project in java, in which I open a pdf file with an option, when I run it from IntelliJ, it uploads the file without problems, but at the time of creating the .jar it does not load it and it tells me that it does not exist the file. The code is as follows:
if (e.getSource() == menuLenguaje){
try {
File path = new File(getClass().getResource("/Archivos/lenguaje.pdf").getFile());
Desktop.getDesktop().open(path);
}catch (IOException ex) {
ex.printStackTrace();
}
I know if I put it in a folder (package) called Files or I send it to call from the location in src, it does not load the file.