I am trying to access a file using the class path like so:
String path = getClass().getProtectionDomain().getCodeSource()
.getLocation().toString();
File test = new File(path);
File table = new File(test, "testFile.xlsx");
I am doing this because I need to create a Jar that will read and write to this file if it is in the same folder.
I get this error:
java.io.FileNotFoundException: "myFilepath" (The filename, directory name, or volume label syntax is incorrect)
If I copy and paste myFilepath in a file browser it brings up my file. Anyone see what I am doing wrong, or ways I can improve my methods?