I want to attach User Instructions to a Java application, and allow the user to open it from the help menuitem.
I'm not very familiar with classpath variables. If I use an absolute path name everything is fine, such as
File pdfFile = new File("C:/Program Files/MyProgram/UserGuide.pdf");
But I want to package the UserGuide in the jar file (to avoid issues openning it on a Mac or Linux machine, and prevent the user from deleting it etc.).
So I want to access it using
File pdfFile = new File("files/UserGuide.pdf");
where files is a directory in the package where the main method's class is located. But I get an error
java.io.FileNotFoundException: files\UserGuide.pdf (The system cannot find the path specified)
In Eclipse how do I achieve this?