java - System cannot find the file specified -
i have program in jar file, several csv files located in root directory of jar file. code importing files program looks :
public static final string stringfile = "file.csv";
the error says "file.csv (the system cannot find file specified)." i'm wondering why wouldn't work if files in root directory of jar, there special need access them, or not possible , still need have path leading file?
thanks!
your example (if extrapolate you're doing new file(stringfile)
) file on file system in same directory run java file, not search classpath.
you want either classloader.getresource()
or classloader.getresourceasstream()
you classloader issuing this.getclass().getclassloader()
Comments
Post a Comment